diff --git a/.chronus/changes/add-typespec-java-2026-6-25-0-0-0.md b/.chronus/changes/add-typespec-java-2026-6-25-0-0-0.md new file mode 100644 index 0000000000..c6e19829af --- /dev/null +++ b/.chronus/changes/add-typespec-java-2026-6-25-0-0-0.md @@ -0,0 +1,8 @@ +--- +changeKind: internal +packages: + - "@azure-tools/typespec-java" +--- + +[Java] Flatten the `typespec-java` emitter folder structure and clean up autorest.java-specific tooling. + diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 4a4e67b5cd..88e6aaa123 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,3 +7,4 @@ /docs/howtos/DataPlane*/ @lmazuel @m-nash @iscai-msft @srnagar @joheredi /packages/typespec-python @iscai-msft @msyyc @tadelesh @l0lawrence @ChenxiJiang333 @kashifkhan +/packages/typespec-java @weidongxu-microsoft @haolingdong-msft @XiaofeiCao diff --git a/.github/actions/setup-java/action.yml b/.github/actions/setup-java/action.yml new file mode 100644 index 0000000000..652dfa096a --- /dev/null +++ b/.github/actions/setup-java/action.yml @@ -0,0 +1,11 @@ +name: Setup Java +description: Setup JDK and Maven for typespec-java package development and CI + +runs: + using: composite + + steps: + - name: Setup mise + uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1 + with: + install_args: "java maven" diff --git a/.github/workflows/ci-java.yml b/.github/workflows/ci-java.yml index f35fa1a52d..c28b6cf24a 100644 --- a/.github/workflows/ci-java.yml +++ b/.github/workflows/ci-java.yml @@ -1,4 +1,4 @@ -name: "typespec-java / CI" +name: "java / test e2e" on: pull_request: @@ -8,35 +8,75 @@ on: paths: - "packages/typespec-java/**" - ".github/workflows/ci-java.yml" + - ".github/actions/setup-java/**" merge_group: permissions: contents: read +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: - name: Build + name: "Build & Test" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: submodules: recursive + - uses: ./.github/actions/setup + + - uses: ./.github/actions/setup-java + - name: Install dependencies run: pnpm install - - name: Build typespec-java package + + # Build the emitter (build:generator builds emitter.jar from the core + # generator after applying core.patch; build:emitter copies sources + tsc) + # together with the peer packages it compiles against. + - name: Build run: pnpm turbo run --filter "@azure-tools/typespec-java..." build - lint: - name: Lint - runs-on: ubuntu-latest + + - name: Test (emitter unit tests) + run: pnpm run test + working-directory: packages/typespec-java + + e2e: + name: "Regen & Spector Tests" needs: build + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: submodules: recursive + - uses: ./.github/actions/setup + + - uses: ./.github/actions/setup-java + - name: Install dependencies run: pnpm install - - name: Run linters - working-directory: packages/typespec-java - run: pnpm lint + + # The emitter compiles against these peer packages; Generate.ps1 -> Setup.ps1 + # -> Build-TypeSpec.ps1 runs `pnpm build` for the emitter, which needs them + # already built. + - name: Build dependencies + run: pnpm turbo run --filter "@azure-tools/typespec-java^..." build + + # emitter-tests is a standalone npm+Maven project (not in the pnpm + # workspace). Generate.ps1 calls Setup.ps1 (builds the emitter + Azure jar, + # npm install) and regenerates the SDK from the spector specs into the + # gitignored src/main/java. Spector-Tests.ps1 then runs the JUnit tests + # against the Spector mock server. + - name: Regenerate + shell: pwsh + run: ./Generate.ps1 + working-directory: packages/typespec-java/emitter-tests + + - name: Spector tests + shell: pwsh + run: ./Spector-Tests.ps1 + working-directory: packages/typespec-java/emitter-tests diff --git a/.github/workflows/nightly-e2e.yml b/.github/workflows/nightly-e2e.yml index c9a90724e8..5d029ab4d5 100644 --- a/.github/workflows/nightly-e2e.yml +++ b/.github/workflows/nightly-e2e.yml @@ -55,6 +55,13 @@ jobs: working-directory: packages/typespec-ts run-prepare: false run-regenerate: false + - name: Java + lang: java + package-filter: "@azure-tools/typespec-java" + working-directory: packages/typespec-java/emitter-tests + mise-install-args: "java maven" + run-prepare: false + run-regenerate: true env: TYPESPEC_VS_CI_BUILD: true @@ -155,6 +162,7 @@ jobs: "@azure-tools/typespec-azure-resource-manager", "@azure-tools/typespec-autorest", "@azure-tools/typespec-python", + "@azure-tools/typespec-java", "@azure-tools/typespec-ts" ]; console.log("--- Dev versions (next tag on npm) ---"); diff --git a/.gitignore b/.gitignore index 34e9bbcbd8..8901197b3c 100644 --- a/.gitignore +++ b/.gitignore @@ -227,8 +227,23 @@ packages/typespec-python/tests/generated/** packages/typespec-python/alpha # java emitter -packages/typespec-java/src/typespec-extension/generator/** -packages/typespec-java/src/typespec-extension/test -packages/typespec-java/src/typespec-extension/src/* -packages/typespec-java/src/typespec-extension/generator/** -!packages/typespec-java/src/typespec-extension/options.ts +# Emitter TS sources copied from core/packages/http-client-java/emitter at build +# time (only src/options.ts is committed). +packages/typespec-java/src/** +!packages/typespec-java/src/options.ts +packages/typespec-java/test/** +# Java emitter.jar + assets staged from the core generator build. +packages/typespec-java/generator/** +# Packed tarball produced by Build-TypeSpec.ps1 (consumed by emitter-tests). +packages/typespec-java/*.tgz + +# java emitter-tests (standalone Maven+npm spector suite) +# Generated SDK + generated tests are regenerated, never committed; only +# hand-written tests, specs, customization and the harness are tracked. +packages/typespec-java/emitter-tests/src/main/** +packages/typespec-java/emitter-tests/**/generated/** +packages/typespec-java/emitter-tests/tsp-output/** +packages/typespec-java/emitter-tests/specs/** +packages/typespec-java/emitter-tests/node_modules/** +packages/typespec-java/emitter-tests/package-lock.json +packages/typespec-java/emitter-tests/tsp-spector-coverage-*.json diff --git a/.prettierignore b/.prettierignore index 506823eca3..f12d166034 100644 --- a/.prettierignore +++ b/.prettierignore @@ -101,3 +101,13 @@ packages/typespec-ts/test/integration/generated/ packages/typespec-ts/test/azure-integration/generated/ packages/typespec-ts/test/modular-integration/generated/ packages/typespec-ts/test/azure-modular-integration/generated/ + +# typespec-java emitter-tests is a standalone npm project (excluded from the pnpm +# workspace) with its own .prettierrc.yaml that loads the typespec prettier plugin +# from its own node_modules. Those aren't installed in the root format job, so root +# prettier must not descend into it; the project formats itself via its own scripts. +packages/typespec-java/emitter-tests/ +# Emitter TypeScript sources (except options.ts) are copied from core at build time. +packages/typespec-java/src/** +!packages/typespec-java/src/options.ts +packages/typespec-java/test/ diff --git a/cspell.yaml b/cspell.yaml index 6abd6c7716..3adfdd5886 100644 --- a/cspell.yaml +++ b/cspell.yaml @@ -26,175 +26,92 @@ ignorePaths: - "*.lock.yml" # temp ignore typespec-ts while repo move is inflight - packages/typespec-ts/** + # typespec-java specs and hand-written tests are synced verbatim from + # core / autorest.java; don't spell-check upstream-sourced content. + - packages/typespec-java/emitter-tests/tsp/** + - packages/typespec-java/emitter-tests/src/** + # Developer/user docs ported verbatim from autorest.java's typespec-extension. + - packages/typespec-java/docs/** useGitignore: true enableFiletypes: - tsp - typespec words: - - AADDS - - adtest - - alexa - allof - apim - - appinsightsappid - apos - armcontoso - armId - - Arqs - - azcore - - azkeys - azsdk - - azsecrets - Bazs - - Bcff - - BNOT - byos - - byval - - centralus - - centraluseuap - chartjs - - Chenjie - - clazz - clsx - - Cmek - - commitish - contosobenchmark - contosowidgetmanager - - DALMATION - - dcont - - deduplicator - - devcenter - - Dhttp - - discriminatorenum - - Dlocal - - Dmaven + - Chenjie - DMSS - Donezo - - DskipTests - - Dspotless - - Dtrim - dynatrace - - Easm - - endpointlro - - ESRPRELPACMANTEST - espt - - euap - - exampleapptenantid - - exampleid - - farchived - fhir - foos - français - - Globa - - groupme - - GZRS - healthdataaiservices - horiz - Howtos - incentivizes - infile - - ipconfigurations - kvset - kwargs - liftr - LINUXNEXTVMIMAGE - LINUXOS - LINUXVMIMAGE - - llcinitial - - llcresi - - llcupdate - - LNOT - locationyaml - logz - LRO - lropaging - - lroparameterizedendpoints - Lucene - - luisappid - MACVMIMAGE - mgmt - - mkdirp - mobo - - msaappid - - msaapptenantid - msazure - msdata - - mycert - - mycompany - mylocation - - mysignalrservice - - ndash - - noflatten - - nonstringenum - - northcentralus - - notypedheadersmethods - nsps - nupkg - odata - - okhttp - - olcmtest - - olcmtestcontainer - Onco - oncophenotype - - Pageble - PAYG - - petstoreopgrp - popd - - println - prismjs - - propery - psscriptanalyzer - - Ptest - pushd - - pypi - pystac - pytest - qnas - - RAGRS - - RAGZRS - regionality + - responseasbool - reinjected - Reranker - - requiredfieldsascotrargstransformation - - requirexmsflattened - - responseasbool - rpaasoneboxacr - rpass - - Rscc - - Rscd - - Rsce - - Rscl - - Rsct - - sampleclientid - - scont - - Serv - SERVICERP - seti - - signalr - - Skus - - southcentralus - stac - strconv - - streamstyleserializationctorargs - - subid - - subscriptionidapiversion - - supportsnetworkacls - tcgc - - testcmk - - tofile - tsmv - - uknorth - - uksouth - - ukwest - userrp - vnet - - westcentralus - WINDOWSVMIMAGE - - Xcognitive - azcore - azkeys - azsecrets - byval + - devcenter - petstoreopgrp - pypi - Tsps diff --git a/eng/pipelines/jobs/build-for-publish.yml b/eng/pipelines/jobs/build-for-publish.yml index e96343209a..3d4e610966 100644 --- a/eng/pipelines/jobs/build-for-publish.yml +++ b/eng/pipelines/jobs/build-for-publish.yml @@ -41,6 +41,24 @@ jobs: PackagePath: packages/typespec-python GeneratorName: "@azure-tools/typespec-python" + # Java e2e tests and spector coverage upload. The emitter-tests project is a + # standalone npm+Maven project (not in the pnpm workspace). The emitter + its + # dependencies are already built by the repo-wide `pnpm build` above, so pass + # -SkipBuild: Generate.ps1 -> Setup.ps1 only packs the .tgz, npm installs it and + # regenerates the SDK from the spector specs; Spector-Tests.ps1 starts the + # mock server, runs the JUnit tests and produces tsp-spector-coverage-java.json. + - pwsh: ./Generate.ps1 -SkipBuild + displayName: "Regenerate Java test code" + workingDirectory: packages/typespec-java/emitter-tests + + - pwsh: ./Spector-Tests.ps1 + displayName: "Run Java spector tests" + workingDirectory: packages/typespec-java/emitter-tests + + - template: /eng/pipelines/templates/upload-spector-coverage.yml + parameters: + PackagePath: packages/typespec-java/emitter-tests + GeneratorName: "@azure-tools/typespec-java" # TypeScript (typespec-ts) e2e tests and spector coverage upload. # The emitter was migrated here from Azure/autorest.typescript; this replaces # the coverage upload that previously ran in that (now deprecated) repo. diff --git a/eng/pipelines/templates/install.yml b/eng/pipelines/templates/install.yml index 048335430c..236951bfa3 100644 --- a/eng/pipelines/templates/install.yml +++ b/eng/pipelines/templates/install.yml @@ -17,6 +17,17 @@ steps: displayName: Install Node.js retryCountOnTaskFailure: 3 + # typespec-java is in the pnpm workspace, so the repo-wide `pnpm build` builds + # its emitter.jar via Maven and therefore needs a JDK. The emitter targets + # JDK 11 (see mise.toml `java = microsoft-11`). Maven is preinstalled on the + # hosted image. + - task: JavaToolInstaller@0 + displayName: "Use Java 11" + inputs: + versionSpec: "11" + jdkArchitectureOption: "x64" + jdkSourceOption: "PreInstalled" + - template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml - task: Cache@2 diff --git a/packages/typespec-java/Build-Generator.ps1 b/packages/typespec-java/Build-Generator.ps1 new file mode 100644 index 0000000000..a21e224512 --- /dev/null +++ b/packages/typespec-java/Build-Generator.ps1 @@ -0,0 +1,56 @@ +# Build the Java emitter.jar from the core generator at +# core/packages/http-client-java/generator, after applying the Azure customization +# patch (core.patch) so the jar uses Azure's com.azure.tools:azure-autorest-customization +# instead of the unbranded one. This is the "build:generator" half of the package +# build (the "build:emitter" half is Copy-Sources.ps1 + tsc). +# +# Requires JDK 11+ and Apache Maven on PATH. +# +# WARNING: this script runs `git checkout .` inside the ./core submodule to apply +# and later revert the patch. Stage/commit any local changes there first. + +$ErrorActionPreference = "Stop" + +$packageRoot = $PSScriptRoot +$repoRoot = Resolve-Path (Join-Path $packageRoot ".." "..") +$coreRoot = Join-Path $repoRoot "core" +$generatorRoot = Join-Path $coreRoot "packages" "http-client-java" "generator" +$generatorPom = Join-Path $generatorRoot "pom.xml" +$patchFile = Join-Path $packageRoot "core.patch" + +if (-not (Test-Path $generatorPom)) { + Write-Error "core/ generator not found at: $generatorPom`nMake sure the 'core' submodule is checked out (git submodule update --init --recursive)." +} + +try { + Write-Host "Apply Azure customization patch to core" + Push-Location $coreRoot + try { + git checkout . + git apply $patchFile --ignore-whitespace + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + } + finally { + Pop-Location + } + + Write-Host "Build JAR" + mvn clean install -DskipTests --define spotless:skip --no-transfer-progress -T 1C -f $generatorPom + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + + Write-Host "Copy JAR to package 'generator' directory" + $sourceTargetDir = Join-Path $generatorRoot "http-client-generator" "target" + $destTargetDir = Join-Path $packageRoot "generator" "http-client-generator" "target" + New-Item -ItemType Directory -Path (Join-Path $destTargetDir "classes") -Force | Out-Null + Copy-Item (Join-Path $sourceTargetDir "emitter.jar") (Join-Path $destTargetDir "emitter.jar") -Force + Copy-Item (Join-Path $sourceTargetDir "classes" "PerfAutomation.jfc") (Join-Path $destTargetDir "classes" "PerfAutomation.jfc") -Force +} +finally { + # Revert the transient core.patch so the working tree (and the core submodule) + # is left clean -- repo-wide `pnpm build` runs this and CI checks git status. + git -C $coreRoot checkout . +} diff --git a/packages/typespec-java/Build-TypeSpec.ps1 b/packages/typespec-java/Build-TypeSpec.ps1 new file mode 100644 index 0000000000..c353e444b8 --- /dev/null +++ b/packages/typespec-java/Build-TypeSpec.ps1 @@ -0,0 +1,27 @@ +# Build the @azure-tools/typespec-java package and pack it into a .tgz. +# +# `pnpm build` runs build:generator (Build-Generator.ps1: apply core.patch, build +# emitter.jar from core, revert patch) then build:emitter (Copy-Sources.ps1 + tsc). +# `pnpm pack` then produces a tarball with the catalog:/workspace: protocols +# resolved to real versions, which the standalone emitter-tests project consumes +# via a file: path. +# +# Requires JDK 11+ and Apache Maven on PATH (for build:generator). + +$ErrorActionPreference = "Stop" + +Push-Location $PSScriptRoot +try { + pnpm build + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + + pnpm pack --pack-destination . + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } +} +finally { + Pop-Location +} diff --git a/packages/typespec-java/src/typespec-extension/changelog.md b/packages/typespec-java/CHANGELOG.md similarity index 95% rename from packages/typespec-java/src/typespec-extension/changelog.md rename to packages/typespec-java/CHANGELOG.md index 592ecbb0fe..1176754326 100644 --- a/packages/typespec-java/src/typespec-extension/changelog.md +++ b/packages/typespec-java/CHANGELOG.md @@ -1,4 +1,36 @@ -# Release History +# Change Log - @azure-tools/typespec-java + +## 0.45.4 (2026-06-18) + +Compatible with compiler 1.13.0. + +- Updated package dependencies to the latest versions. +- Fix duplicate method in generated samples, when advanced-versioning=true. +- Fix null LRO error response body handling in generated management clients. + +## 0.45.3 (2026-06-11) + +Compatible with compiler 1.13.0. + +- Updated package dependencies to the latest versions. + +## 0.45.2 (2026-06-08) + +Compatible with compiler 1.12.0. + +- Updated package dependencies to the latest versions. + +## 0.45.1 (2026-05-20) + +Compatible with compiler 1.12.0. + +- Updated package dependencies to the latest versions. + +## 0.45.0 (2026-05-13) + +Compatible with compiler 1.12.0. + +- Updated package dependencies to the latest versions. ## 0.44.6 (2026-04-23) @@ -458,7 +490,7 @@ Compatible with compiler 0.62. Compatible with compiler 0.62. - Supported `enable-subclient` emitter option. -- Supported `@clientNamespace` from "@azure-tools/typespec-client-generator-core". +- Supported `@clientNamespace` from "@azure-tools/typespec-client-generator-core". ## 0.25.0 (2024-11-14) @@ -512,7 +544,7 @@ Compatible with compiler 0.59. - Adopt TCGC `sdkPackage`. - Always allow override `endpoint` parameter in `Builder`. -- Client method parameters' order changes when define the method parameters using spread in TypeSpec. +- Client method parameters' order changes when define the method parameters using spread in TypeSpec. ## 0.19.3 (2024-08-21) @@ -584,7 +616,7 @@ Compatible with compiler 0.56. Compatible with compiler 0.56. - Generate `OperationLocationPollingStrategy` class in implementation package for long-running operation. - The generated lib would no longer need to depend on the `azure-core-experimental` lib. +The generated lib would no longer need to depend on the `azure-core-experimental` lib. ## 0.16.1 (2024-05-29) @@ -756,7 +788,7 @@ Compatible with compiler 0.52. Compatible with compiler 0.52. -- Behavior changed on "multipart/form-data" request. The file field would take a `##FileDetails` model, instead of `BinaryData`. +- Behavior changed on "multipart/form-data" request. The file field would take a `##FileDetails` model, instead of `BinaryData`. ## 0.13.0 (2024-01-25) @@ -792,7 +824,7 @@ Compatible with compiler 0.51. Compatible with compiler 0.50. - Supported `crossLanguageDefinitionId`. -- Supported `decimal` scalar. +- Supported `decmial` scalar. ## 0.11.2 (2023-11-16) diff --git a/packages/typespec-java/CONTRIBUTING.md b/packages/typespec-java/CONTRIBUTING.md new file mode 100644 index 0000000000..469452372c --- /dev/null +++ b/packages/typespec-java/CONTRIBUTING.md @@ -0,0 +1,67 @@ +# Contributing + +This project welcomes contributions and suggestions. Most contributions require you to agree to a +Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us +the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com. + +When you submit a pull request, a CLA bot will automatically determine whether you need to provide +a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions +provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or +contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Package layout + +`@azure-tools/typespec-java` is the branded Java emitter. It wraps the unbranded emitter +`@typespec/http-client-java`, which lives in the `core/` submodule at +`core/packages/http-client-java`. + +Only `src/options.ts` (the Azure-specific emitter options) is committed in this package. The rest of +the emitter TypeScript (and tests) is copied from `core/packages/http-client-java/emitter/{src,test}` +at build time by `Copy-Sources.ps1` (excluding `options.ts`). The Java `emitter.jar` is +built from `core/packages/http-client-java/generator` by `Build-Generator.ps1` and staged into +`generator/http-client-generator/target/`. + +### Azure customization patch + +Before building the jar, `Build-Generator.ps1` applies `core.patch` to the `core/` submodule. +This swaps the unbranded customization engine in `http-client-generator-core` for Azure's +`com.azure.tools:azure-autorest-customization` (resolved from Maven Central), so the +`customization-class` emitter option runs against the Azure customization base. The patch is applied +transiently at build time (the script runs `git checkout .` in `core/` to apply and again to revert +it), so commit/stage any local `core/` changes before building. When the `core/` submodule is bumped, +refresh `core.patch` if its context no longer applies. + +## Build + +```bash +# Full build: build:generator (emitter.jar via Maven + core.patch, requires JDK 11+ +# and Maven) then build:emitter (copy sources from core + tsc). +pnpm build + +# Just the TypeScript half (no jar; fast): +pnpm build:emitter + +# Build and pack a .tgz (what emitter-tests consumes): +pwsh ./Build-TypeSpec.ps1 +``` + +## Before making a Pull request + +Make sure to run the following commands: + +- `pnpm format` + +## Release Process + +TODO: The post-release process for `@azure-tools/typespec-java` has not been finalized yet. + +## Trademarks + +This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft +trademarks or logos is subject to and must follow +[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). +Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. +Any use of third-party trademarks or logos are subject to those third-party's policies. diff --git a/packages/typespec-java/Copy-Sources.ps1 b/packages/typespec-java/Copy-Sources.ps1 new file mode 100644 index 0000000000..3a0585ec28 --- /dev/null +++ b/packages/typespec-java/Copy-Sources.ps1 @@ -0,0 +1,14 @@ +# Copy the emitter TypeScript sources (and tests) from the upstream +# @typespec/http-client-java checkout in the core/ submodule into this package, +# so `@azure-tools/typespec-java` builds the same emitter while keeping its own +# Azure-flavored `src/options.ts` (excluded from the copy). +# +# Mirrors the "Copy TypeScript code" step of autorest.java's Build-TypeSpec.ps1. + +$ErrorActionPreference = "Stop" + +$packageRoot = $PSScriptRoot +$emitterRoot = Resolve-Path (Join-Path $packageRoot ".." ".." "core" "packages" "http-client-java" "emitter") + +Copy-Item -Path (Join-Path $emitterRoot "src") -Destination $packageRoot -Exclude "options.ts" -Recurse -Force +Copy-Item -Path (Join-Path $emitterRoot "test") -Destination $packageRoot -Recurse -Force diff --git a/packages/typespec-java/README.md b/packages/typespec-java/README.md new file mode 100644 index 0000000000..1593f10e61 --- /dev/null +++ b/packages/typespec-java/README.md @@ -0,0 +1,47 @@ +# Prerequisite + +Install [Node.js](https://nodejs.org/en/download/) 22 or above. (Verify by running `node --version`) + +Install [Java](https://docs.microsoft.com/java/openjdk/download) 11 or above. (Verify by running `java --version`) + +Install [Maven](https://maven.apache.org/download.cgi). (Verify by running `mvn --version`) + +Install [TypeSpec](https://typespec.io/). + +# Initialize TypeSpec Project + +Follow [TypeSpec Getting Started](https://typespec.io/docs/) to initialize your TypeSpec project. + +Make sure `npx tsp compile .` runs correctly. + +# Add typespec-java + +Run the command `npm install @azure-tools/typespec-java`. + +# Generate Java + +Run `npx tsp compile client.tsp --emit=@azure-tools/typespec-java` +or `npx tsp compile client.tsp --emit=@azure-tools/typespec-java --options='@azure-tools/typespec-java.emitter-output-dir='`. + +If the `emitter-output-dir` option is not provided, the generated Java code will be under the `tsp-output/@azure-tools/typespec-java` folder. + +# Emitter options + +`@azure-tools/typespec-java` is the Azure (branded) emitter. It wraps the unbranded +[`@typespec/http-client-java`](https://github.com/microsoft/typespec/tree/main/packages/http-client-java) +emitter and adds Azure-specific emitter options. See +[the emitter options reference](https://azure.github.io/typespec-azure/docs/emitters/clients/typespec-java/reference) +for the full list. + +```yaml +emit: + - "@azure-tools/typespec-java" +options: + "@azure-tools/typespec-java": + emitter-output-dir: "{project-root}/azure-ai-language-authoring" + service-name: "Authoring" + generate-samples: true + generate-tests: true + partial-update: false + api-version: "2023-11-01" +``` diff --git a/packages/typespec-java/core.patch b/packages/typespec-java/core.patch new file mode 100644 index 0000000000..4189877e5d --- /dev/null +++ b/packages/typespec-java/core.patch @@ -0,0 +1,48 @@ +diff --git a/packages/http-client-java/generator/http-client-generator-core/pom.xml b/packages/http-client-java/generator/http-client-generator-core/pom.xml +index 2015b7761..d5103d017 100644 +--- a/packages/http-client-java/generator/http-client-generator-core/pom.xml ++++ b/packages/http-client-java/generator/http-client-generator-core/pom.xml +@@ -51,6 +51,11 @@ + + + ++ ++ com.azure.tools ++ azure-autorest-customization ++ 1.0.0-beta.11 ++ + + io.clientcore + core +diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/postprocessor/Postprocessor.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/postprocessor/Postprocessor.java +index e9b1e0a49..18955e7d7 100644 +--- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/postprocessor/Postprocessor.java ++++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/postprocessor/Postprocessor.java +@@ -3,8 +3,8 @@ + + package com.microsoft.typespec.http.client.generator.core.postprocessor; + +-import com.microsoft.typespec.http.client.generator.core.customization.Customization; +-import com.microsoft.typespec.http.client.generator.core.customization.implementation.Utils; ++import com.azure.autorest.customization.Customization; ++import com.azure.autorest.customization.implementation.Utils; + import com.microsoft.typespec.http.client.generator.core.extension.base.util.FileUtils; + import com.microsoft.typespec.http.client.generator.core.extension.plugin.JavaSettings; + import com.microsoft.typespec.http.client.generator.core.extension.plugin.NewPlugin; +diff --git a/packages/http-client-java/generator/http-client-generator/src/main/resources/readme/pom.xml b/packages/http-client-java/generator/http-client-generator/src/main/resources/readme/pom.xml +index 58fc6b54d..09804e3f0 100644 +--- a/packages/http-client-java/generator/http-client-generator/src/main/resources/readme/pom.xml ++++ b/packages/http-client-java/generator/http-client-generator/src/main/resources/readme/pom.xml +@@ -16,9 +16,9 @@ + + + +- com.microsoft.typespec +- http-client-generator-core +- 1.0.0-beta.1 ++ com.azure.tools ++ azure-autorest-customization ++ 1.0.0-beta.11 + + + diff --git a/packages/typespec-java/src/docs/client/initializing.md b/packages/typespec-java/docs/client/initializing.md similarity index 100% rename from packages/typespec-java/src/docs/client/initializing.md rename to packages/typespec-java/docs/client/initializing.md diff --git a/packages/typespec-java/src/docs/client/models.md b/packages/typespec-java/docs/client/models.md similarity index 100% rename from packages/typespec-java/src/docs/client/models.md rename to packages/typespec-java/docs/client/models.md diff --git a/packages/typespec-java/src/docs/client/operations.md b/packages/typespec-java/docs/client/operations.md similarity index 100% rename from packages/typespec-java/src/docs/client/operations.md rename to packages/typespec-java/docs/client/operations.md diff --git a/packages/typespec-java/src/docs/client/readme.md b/packages/typespec-java/docs/client/readme.md similarity index 100% rename from packages/typespec-java/src/docs/client/readme.md rename to packages/typespec-java/docs/client/readme.md diff --git a/packages/typespec-java/src/docs/client/troubleshooting.md b/packages/typespec-java/docs/client/troubleshooting.md similarity index 100% rename from packages/typespec-java/src/docs/client/troubleshooting.md rename to packages/typespec-java/docs/client/troubleshooting.md diff --git a/packages/typespec-java/src/docs/developer/2022-05-18-dpg-archboard-review.md b/packages/typespec-java/docs/developer/2022-05-18-dpg-archboard-review.md similarity index 100% rename from packages/typespec-java/src/docs/developer/2022-05-18-dpg-archboard-review.md rename to packages/typespec-java/docs/developer/2022-05-18-dpg-archboard-review.md diff --git a/packages/typespec-java/src/docs/developer/2022-09-13-dpg-archboard-review.md b/packages/typespec-java/docs/developer/2022-09-13-dpg-archboard-review.md similarity index 100% rename from packages/typespec-java/src/docs/developer/2022-09-13-dpg-archboard-review.md rename to packages/typespec-java/docs/developer/2022-09-13-dpg-archboard-review.md diff --git a/packages/typespec-java/src/docs/developer/code-generator-mode.md b/packages/typespec-java/docs/developer/code-generator-mode.md similarity index 100% rename from packages/typespec-java/src/docs/developer/code-generator-mode.md rename to packages/typespec-java/docs/developer/code-generator-mode.md diff --git a/packages/typespec-java/src/docs/developer/design.md b/packages/typespec-java/docs/developer/design.md similarity index 100% rename from packages/typespec-java/src/docs/developer/design.md rename to packages/typespec-java/docs/developer/design.md diff --git a/packages/typespec-java/src/docs/developer/parameter-transformation.md b/packages/typespec-java/docs/developer/parameter-transformation.md similarity index 100% rename from packages/typespec-java/src/docs/developer/parameter-transformation.md rename to packages/typespec-java/docs/developer/parameter-transformation.md diff --git a/packages/typespec-java/src/docs/developer/readme.md b/packages/typespec-java/docs/developer/readme.md similarity index 100% rename from packages/typespec-java/src/docs/developer/readme.md rename to packages/typespec-java/docs/developer/readme.md diff --git a/packages/typespec-java/src/docs/developer/typespec/readme.md b/packages/typespec-java/docs/developer/typespec/readme.md similarity index 70% rename from packages/typespec-java/src/docs/developer/typespec/readme.md rename to packages/typespec-java/docs/developer/typespec/readme.md index 93884328b7..674e38bced 100644 --- a/packages/typespec-java/src/docs/developer/typespec/readme.md +++ b/packages/typespec-java/docs/developer/typespec/readme.md @@ -12,18 +12,18 @@ This repository is checked out at `core` folder as submodule. ### Build -NPM package is in `typespec-extension` folder. +The emitter NPM package is at the `packages/typespec-java` root. The [`Build-TypeSpec.ps1` script](../../../Build-TypeSpec.ps1) builds the emitter. -It first build the JAR using Maven, copy it into `typespec-extension` folder, then build and pack the NPM package to a `tgz` file. +It first build the JAR using Maven, copy it into the package root, then build and pack the NPM package to a `tgz` file. ### Integrated Test -End-to-end test resides in `typespec-tests` folder. +End-to-end test resides in the `emitter-tests` folder. At present, the tests is copied from -The [`Generate.ps1` script](../../../typespec-tests/Generate.ps1) generates the test code from [http-specs](https://github.com/microsoft/typespec/tree/main/packages/http-specs) and [azure-http-specs](https://github.com/Azure/typespec-azure/tree/main/packages/azure-http-specs). +The [`Generate.ps1` script](../../../emitter-tests/Generate.ps1) generates the test code from [http-specs](https://github.com/microsoft/typespec/tree/main/packages/http-specs) and [azure-http-specs](https://github.com/Azure/typespec-azure/tree/main/packages/azure-http-specs). `npm run spector-serve` starts the mock server. @@ -31,17 +31,17 @@ Then standard Maven Surefire would run the tests. ## Publish `@azure-tools/typespec-java` to NPM -1. Update `version` in `typespec-extension/package.json`. -2. Update `typespec-java` `version` in `typespec-test/package.json`. -3. Update `typespec-extensions/changelog.md`, merge the PR. +1. Update `version` in `package.json`. +2. Update `typespec-java` `version` in `emitter-tests/package.json`. +3. Update `CHANGELOG.md`, merge the PR. 4. Run "typespec-java - publish" in (internal) DevOps. -5. Update Release notes in [GitHub Releases](https://github.com/Azure/autorest.java/releases). +5. Update Release notes in [GitHub Releases](https://github.com/Azure/typespec-azure/releases). ## Debugging ### Debugging TypeScript Code -In project that runs TypeSpec compiler (e.g. `typespec-tests` folder), run +In project that runs TypeSpec compiler (e.g. `emitter-tests` folder), run ```shell node --inspect-brk "node_modules/@typespec/compiler/dist/src/core/cli/cli.js" compile @@ -50,13 +50,13 @@ node --inspect-brk "node_modules/@typespec/compiler/dist/src/core/cli/cli.js" co to run `tsp compile` in debug mode (as Node.js process). Then, have the debugging client attach to port 9229 of the Node.js process. -Here is a [Visual Studio Code configuration](../../../typespec-tests/.vscode/launch.json). +Here is a [Visual Studio Code configuration](../../../emitter-tests/.vscode/launch.json). Add break point to the `emitter.js` or `code-model-builder.js` under `node_modules/@azure-tools/typespec-java/dist/src` to debug the emitter. ### Debugging Java Code -See [Debugging Java Code](../../../typespec-extension/readme.md#debugging-java-code). +See [Contributing guide](../../../CONTRIBUTING.md). Alternatively, since the communication from TypeScript to Java is via the `code-model.yaml` file (plus the `EmitterOptions`), one can modify the `DEFAULT_OUTPUT_DIR` in `Main.java` under `core/packages/http-client-java/generator/http-client-generator` and debug `Main.main()`. diff --git a/packages/typespec-java/src/docs/faq.md b/packages/typespec-java/docs/faq.md similarity index 100% rename from packages/typespec-java/src/docs/faq.md rename to packages/typespec-java/docs/faq.md diff --git a/packages/typespec-java/src/docs/generate/customizations.md b/packages/typespec-java/docs/generate/customizations.md similarity index 100% rename from packages/typespec-java/src/docs/generate/customizations.md rename to packages/typespec-java/docs/generate/customizations.md diff --git a/packages/typespec-java/src/docs/generate/dataplane-customization.md b/packages/typespec-java/docs/generate/dataplane-customization.md similarity index 100% rename from packages/typespec-java/src/docs/generate/dataplane-customization.md rename to packages/typespec-java/docs/generate/dataplane-customization.md diff --git a/packages/typespec-java/src/docs/generate/dataplane.md b/packages/typespec-java/docs/generate/dataplane.md similarity index 100% rename from packages/typespec-java/src/docs/generate/dataplane.md rename to packages/typespec-java/docs/generate/dataplane.md diff --git a/packages/typespec-java/src/docs/generate/fluent.md b/packages/typespec-java/docs/generate/fluent.md similarity index 100% rename from packages/typespec-java/src/docs/generate/fluent.md rename to packages/typespec-java/docs/generate/fluent.md diff --git a/packages/typespec-java/src/docs/generate/readme.md b/packages/typespec-java/docs/generate/readme.md similarity index 100% rename from packages/typespec-java/src/docs/generate/readme.md rename to packages/typespec-java/docs/generate/readme.md diff --git a/packages/typespec-java/src/docs/images/logo.png b/packages/typespec-java/docs/images/logo.png similarity index 100% rename from packages/typespec-java/src/docs/images/logo.png rename to packages/typespec-java/docs/images/logo.png diff --git a/packages/typespec-java/src/docs/images/remote-debugger-config.png b/packages/typespec-java/docs/images/remote-debugger-config.png similarity index 100% rename from packages/typespec-java/src/docs/images/remote-debugger-config.png rename to packages/typespec-java/docs/images/remote-debugger-config.png diff --git a/packages/typespec-java/src/docs/migrate/readme.md b/packages/typespec-java/docs/migrate/readme.md similarity index 100% rename from packages/typespec-java/src/docs/migrate/readme.md rename to packages/typespec-java/docs/migrate/readme.md diff --git a/packages/typespec-java/src/docs/readme.md b/packages/typespec-java/docs/readme.md similarity index 100% rename from packages/typespec-java/src/docs/readme.md rename to packages/typespec-java/docs/readme.md diff --git a/packages/typespec-java/src/docs/samples/readme.md b/packages/typespec-java/docs/samples/readme.md similarity index 100% rename from packages/typespec-java/src/docs/samples/readme.md rename to packages/typespec-java/docs/samples/readme.md diff --git a/packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestService.java b/packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestService.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestService.java rename to packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestService.java diff --git a/packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestServiceBuilder.java b/packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestServiceBuilder.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestServiceBuilder.java rename to packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/AutoRestHeadTestServiceBuilder.java diff --git a/packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/HttpSuccess.java b/packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/HttpSuccess.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/HttpSuccess.java rename to packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/HttpSuccess.java diff --git a/packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/package-info.java b/packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/package-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/package-info.java rename to packages/typespec-java/docs/samples/specification/azure_key_credential/generated/src/main/java/com/azure/key/credential/sample/package-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/azure_key_credential/readme.md b/packages/typespec-java/docs/samples/specification/azure_key_credential/readme.md similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/azure_key_credential/readme.md rename to packages/typespec-java/docs/samples/specification/azure_key_credential/readme.md diff --git a/packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestService.java b/packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestService.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestService.java rename to packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestService.java diff --git a/packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestServiceBuilder.java b/packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestServiceBuilder.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestServiceBuilder.java rename to packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/AutoRestHeadTestServiceBuilder.java diff --git a/packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/HttpSuccess.java b/packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/HttpSuccess.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/HttpSuccess.java rename to packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/HttpSuccess.java diff --git a/packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/package-info.java b/packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/package-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/package-info.java rename to packages/typespec-java/docs/samples/specification/basic/generated/src/main/java/com/azure/basic/sample/package-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/basic/readme.md b/packages/typespec-java/docs/samples/specification/basic/readme.md similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/basic/readme.md rename to packages/typespec-java/docs/samples/specification/basic/readme.md diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/pom.xml b/packages/typespec-java/docs/samples/specification/management/generated/pom.xml similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/pom.xml rename to packages/typespec-java/docs/samples/specification/management/generated/pom.xml diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/ManagementLockManager.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/ManagementLockManager.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/ManagementLockManager.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/ManagementLockManager.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/AuthorizationOperationsClient.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/AuthorizationOperationsClient.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/AuthorizationOperationsClient.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/AuthorizationOperationsClient.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLockClient.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLockClient.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLockClient.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLockClient.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLocksClient.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLocksClient.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLocksClient.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/ManagementLocksClient.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/ManagementLockObjectInner.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/ManagementLockObjectInner.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/ManagementLockObjectInner.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/ManagementLockObjectInner.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/OperationInner.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/OperationInner.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/OperationInner.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/OperationInner.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/package-info.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/package-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/package-info.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/models/package-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/package-info.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/package-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/package-info.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/fluent/package-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsClientImpl.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsClientImpl.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsClientImpl.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsClientImpl.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsImpl.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsImpl.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsImpl.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/AuthorizationOperationsImpl.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientBuilder.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientBuilder.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientBuilder.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientBuilder.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientImpl.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientImpl.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientImpl.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockClientImpl.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockObjectImpl.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockObjectImpl.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockObjectImpl.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLockObjectImpl.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksClientImpl.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksClientImpl.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksClientImpl.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksClientImpl.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksImpl.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksImpl.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksImpl.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/ManagementLocksImpl.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/OperationImpl.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/OperationImpl.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/OperationImpl.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/OperationImpl.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/Utils.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/Utils.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/Utils.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/Utils.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/package-info.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/package-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/package-info.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/implementation/package-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/AuthorizationOperations.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/AuthorizationOperations.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/AuthorizationOperations.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/AuthorizationOperations.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/LockLevel.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/LockLevel.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/LockLevel.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/LockLevel.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockListResult.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockListResult.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockListResult.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockListResult.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockObject.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockObject.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockObject.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockObject.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockOwner.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockOwner.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockOwner.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLockOwner.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLocks.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLocks.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLocks.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/ManagementLocks.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/Operation.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/Operation.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/Operation.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/Operation.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationDisplay.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationDisplay.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationDisplay.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationDisplay.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationListResult.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationListResult.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationListResult.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/OperationListResult.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/package-info.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/package-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/package-info.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/models/package-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/package-info.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/package-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/package-info.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/com/azure/resourcemanager/locks/package-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/module-info.java b/packages/typespec-java/docs/samples/specification/management/generated/src/main/java/module-info.java similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/generated/src/main/java/module-info.java rename to packages/typespec-java/docs/samples/specification/management/generated/src/main/java/module-info.java diff --git a/packages/typespec-java/src/docs/samples/specification/management/readme.md b/packages/typespec-java/docs/samples/specification/management/readme.md similarity index 100% rename from packages/typespec-java/src/docs/samples/specification/management/readme.md rename to packages/typespec-java/docs/samples/specification/management/readme.md diff --git a/packages/typespec-java/emitter-tests/.gitignore b/packages/typespec-java/emitter-tests/.gitignore new file mode 100644 index 0000000000..7181f030f2 --- /dev/null +++ b/packages/typespec-java/emitter-tests/.gitignore @@ -0,0 +1,2 @@ +# ignore ARM generated tests with random mock values +src/test/java/tsptest/**/arm*/generated \ No newline at end of file diff --git a/packages/typespec-java/emitter-tests/.prettierignore b/packages/typespec-java/emitter-tests/.prettierignore new file mode 100644 index 0000000000..8c5521df75 --- /dev/null +++ b/packages/typespec-java/emitter-tests/.prettierignore @@ -0,0 +1 @@ +tsp-src/ diff --git a/packages/typespec-java/emitter-tests/.prettierrc.yaml b/packages/typespec-java/emitter-tests/.prettierrc.yaml new file mode 100644 index 0000000000..173cc43503 --- /dev/null +++ b/packages/typespec-java/emitter-tests/.prettierrc.yaml @@ -0,0 +1,15 @@ +arrowParens: always +trailingComma: es5 +bracketSpacing: true +endOfLine: lf +printWidth: 100 +semi: true +singleQuote: false +tabWidth: 2 +plugins: + - "./node_modules/@typespec/prettier-plugin-typespec/dist/index.js" + - "./node_modules/prettier-plugin-organize-imports/index.js" +overrides: + - files: "*.tsp" + options: + parser: typespec diff --git a/packages/typespec-java/emitter-tests/Generate.ps1 b/packages/typespec-java/emitter-tests/Generate.ps1 new file mode 100644 index 0000000000..bdb17b85b1 --- /dev/null +++ b/packages/typespec-java/emitter-tests/Generate.ps1 @@ -0,0 +1,217 @@ +# Use case: +# +# The purpose of this script is to compact the steps required to regenerate TypeSpec into a single script. +# +# If 'com.azure.autorest.customization' tests fails, re-install 'customization-base'. +# +# Before running this script the 'tsp' profile must be built, 'mvn install -P local,tsp'. +param ( + [int] $Parallelization = [Environment]::ProcessorCount, + # skip the emitter build in Setup.ps1 (only pack + install); use when the + # package was already built by a prior step (e.g. the repo-wide `pnpm build` + # in CI) to avoid a redundant second build + [switch] $SkipBuild = $false +) + +$ExitCode = 0 + +if ($Parallelization -lt 1) { + $Parallelization = 1 +} + +Write-Host "Parallelization: $Parallelization" + +$generateScript = { + $tspFile = $_ + + if ((($tspFile -match "payload[\\/]pageable[\\/]main\.tsp") -and (-not ($tspFile -match "azure[\\/]payload[\\/]pageable[\\/]main\.tsp")))) { + Write-Host " + SKIPPED + $tspFile + " + # nested pageItems/nextLink/continuationToken is not supported + return + } + + $tspClientFile = $tspFile -replace 'main.tsp', 'client.tsp' + if (($tspClientFile -match 'client.tsp$') -and (Test-Path $tspClientFile)) { + $tspFile = $tspClientFile + } + + # With TypeSpec code generation being parallelized, we need to make sure that the output directory is unique + # for each test run. We do this by appending a random number to the output directory. + # Without this, we could have multiple runs trying to write to the same directory which introduces race conditions. + $tspOptions = "--option ""@azure-tools/typespec-java.emitter-output-dir={project-root}/tsp-output/$(Get-Random)""" + if ($tspFile -match "type[\\/]enum[\\/]extensible[\\/]") { + # override namespace for reserved keyword "enum" + $tspOptions += " --option ""@azure-tools/typespec-java.namespace=type.enums.extensible""" + } elseif ($tspFile -match "type[\\/]enum[\\/]fixed[\\/]") { + # override namespace for reserved keyword "enum" + $tspOptions += " --option ""@azure-tools/typespec-java.namespace=type.enums.fixed""" + } elseif ($tspFile -match "azure[\\/]example[\\/]basic[\\/]") { + # override examples-directory + $tspOptions += " --option ""@azure-tools/typespec-java.examples-dir={project-root}/specs/azure/example/basic/examples""" + } elseif ($tspFile -match "azure[\\/]client-generator-core[\\/]client-initialization[\\/]") { + $tspOptions += " --option ""@azure-tools/typespec-java.enable-subclient=true""" + } elseif ($tspFile -match "resiliency[\\/]srv-driven[\\/]old\.tsp") { + # override namespace for "resiliency/srv-driven/old.tsp" (make it different to that from "main.tsp") + $tspOptions += " --option ""@azure-tools/typespec-java.namespace=resiliency.servicedriven.v1""" + # enable advanced versioning for resiliency test + $tspOptions += " --option ""@azure-tools/typespec-java.advanced-versioning=true""" + } elseif ($tspFile -match "resiliency[\\/]srv-driven[\\/]main\.tsp") { + # enable advanced versioning for resiliency test + $tspOptions += " --option ""@azure-tools/typespec-java.advanced-versioning=true""" + } elseif ($tspFile -match "azure[\\/]resource-manager[\\/].*[\\/]main\.tsp") { + # for mgmt, do not generate tests due to random mock values + $tspOptions += " --option ""@azure-tools/typespec-java.generate-tests=false""" + } elseif ($tspFile -match "azure[\\/]resource-manager[\\/]multi-service-shared-models[\\/]") { + $tspOptions += " --option ""@azure-tools/typespec-java.metadata-suffix=shared-models""" + } elseif ($tspFile -match "tsp[\\/]versioning.tsp") { + # test generating from specific api-version + $tspOptions += " --option ""@azure-tools/typespec-java.api-version=2022-09-01""" + } elseif ($tspFile -match "tsp[\\/]error.tsp") { + # test for default-http-exception-type + $tspOptions += " --option ""@azure-tools/typespec-java.use-default-http-status-code-to-exception-type-mapping=false""" + } elseif ($tspFile -match "type[\\/]array" -or $tspFile -match "type[\\/]dictionary") { + # TODO https://github.com/Azure/autorest.java/issues/2964 + # also serve as a test for "use-object-for-unknown" emitter option + $tspOptions += " --option ""@azure-tools/typespec-java.use-object-for-unknown=true""" + } elseif ($tspFile -match "tsp[\\/]arm.tsp") { + # test service-name + $tspOptions += " --option ""@azure-tools/typespec-java.service-name=Arm Resource Provider""" + # also test generating from specific api-version + $tspOptions += " --option ""@azure-tools/typespec-java.api-version=2023-11-01""" + # enable sync-stack + $tspOptions += " --option ""@azure-tools/typespec-java.enable-sync-stack=true""" + # rename model + $tspOptions += " --option ""@azure-tools/typespec-java.rename-model=TopLevelArmResourceListResult:ResourceListResult,CustomTemplateResourcePropertiesAnonymousEmptyModel:AnonymousEmptyModel""" + # remove inner + $tspOptions += " --option ""@azure-tools/typespec-java.remove-inner=NginxConfigurationResponse""" + # generate async methods + $tspOptions += " --option ""@azure-tools/typespec-java.generate-async-methods=true""" + # backward compatible options + $tspOptions += " --option ""@azure-tools/typespec-java.float32-as-double=false""" + $tspOptions += " --option ""@azure-tools/typespec-java.uuid-as-string=false""" + } elseif ($tspFile -match "tsp[\\/]arm-stream-style-serialization.tsp") { + # test service-name + $tspOptions += " --option ""@azure-tools/typespec-java.service-name=Arm Resource Provider""" + # test property-include-always + $tspOptions += " --option ""@azure-tools/typespec-java.property-include-always=FunctionConfiguration.input""" + # enable client side validations + $tspOptions += " --option ""@azure-tools/typespec-java.client-side-validations=true""" + } elseif ($tspFile -match "tsp[\\/]arm-customization.tsp") { + # add customization code + $tspOptions += " --option ""@azure-tools/typespec-java.customization-class=../../customization/src/main/java/KeyVaultCustomization.java""" + } elseif ($tspFile -match "tsp[\\/]arm-versioned.tsp") { + # enable advanced versioning for resiliency test + $tspOptions += " --option ""@azure-tools/typespec-java.advanced-versioning=true""" + $tspOptions += " --option ""@azure-tools/typespec-java.generate-async-methods=true""" + $tspOptions += " --option ""@azure-tools/typespec-java.enable-sync-stack=false""" + } elseif ($tspFile -match "tsp[\\/]subclient.tsp") { + $tspOptions += " --option ""@azure-tools/typespec-java.enable-subclient=true""" + # test for include-api-view-properties + $tspOptions += " --option ""@azure-tools/typespec-java.include-api-view-properties=false""" + } + + # Test customization for one of the TypeSpec definitions - naming.tsp + if ($tspFile -match "tsp[\\/]naming.tsp$") { + # Test for rename-model + $tspOptions += " --option ""@azure-tools/typespec-java.rename-model=RunObjectLastError1:RunObjectLastErrorRenamed,RunObjectLastErrorCode:RunObjectLastErrorCodeRenamed""" + # Add the customization-class option for Java emitter + $tspOptions += " --option ""@azure-tools/typespec-java.customization-class=../../customization/src/main/java/CustomizationTest.java""" + } + + $tspTrace = "--trace import-resolution --trace projection --trace typespec-java" + $tspCommand = "npx --no-install tsp compile $tspFile $tspOptions $tspTrace" + + # output of "tsp compile" seems trigger powershell error or exit, hence the "2>&1" + $timer = [Diagnostics.Stopwatch]::StartNew() + $generateOutput = Invoke-Expression $tspCommand 2>&1 + $timer.Stop() + + $global:ExitCode = $global:ExitCode -bor $LASTEXITCODE + + if ($LASTEXITCODE -ne 0) { + Write-Host " + ======================== + $tspCommand + ======================== + FAILED (Time elapsed: $($timer.ToString())) + $([String]::Join("`n", $generateOutput)) + " + } else { + Write-Host " + ======================== + $tspCommand + ======================== + SUCCEEDED (Time elapsed: $($timer.ToString())) + " + } + + if ($global:ExitCode -ne 0) { + throw "Failed to generate from tsp $tspFile" + } +} + +Push-Location $PSScriptRoot +try { + ./Setup.ps1 -SkipBuild:$SkipBuild + + New-Item -Path ./existingcode/src/main/java/tsptest/ -ItemType Directory -Force | Out-Null + + if (Test-Path ./src/main/java/tsptest/partialupdate) { + Copy-Item -Path ./src/main/java/tsptest/partialupdate -Destination ./existingcode/src/main/java/tsptest/partialupdate -Recurse -Force + } + + if (Test-Path ./src/main) { + Remove-Item ./src/main -Recurse -Force + } + if (Test-Path ./src/samples) { + Remove-Item ./src/samples -Recurse -Force + } + if (Test-Path ./src/test) { + Get-ChildItem -Path ./src/test -Recurse -Directory | Where-Object {$_.Name -match "^generated$"} | Remove-Item -Recurse -Force + } + if (Test-Path ./tsp-output) { + Remove-Item ./tsp-output -Recurse -Force + } + + # generate for other local test sources except partial update + $job = Get-Item ./tsp/* -Filter "*.tsp" -Exclude "*partialupdate*" | ForEach-Object -Parallel $generateScript -ThrottleLimit $Parallelization -AsJob + + $job | Wait-Job -Timeout 600 + $job | Receive-Job + + # partial update test + npx --no-install tsp compile ./tsp/partialupdate.tsp --option="@azure-tools/typespec-java.emitter-output-dir={project-root}/existingcode" + Copy-Item -Path ./existingcode/src/main/java/tsptest/partialupdate -Destination ./src/main/java/tsptest/partialupdate -Recurse -Force + Remove-Item ./existingcode -Recurse -Force + + # generate for http-specs/azure-http-specs test sources + Copy-Item -Path node_modules/@typespec/http-specs/specs -Destination ./ -Recurse -Force + Copy-Item -Path node_modules/@azure-tools/azure-http-specs/specs -Destination ./ -Recurse -Force + # remove xml tests, emitter has not supported xml model + Remove-Item ./specs/payload/xml -Recurse -Force + + $specFiles = Get-ChildItem ./specs -Include "main.tsp","old.tsp" -File -Recurse + # ensure multi-service client specs are processed even though they do not match the default filter + $specFiles += Get-Item (Join-Path ./specs "azure/resource-manager/multi-service/client.tsp") + $specFiles += Get-Item (Join-Path ./specs "azure/resource-manager/multi-service-shared-models/client.tsp") + + $job = $specFiles | ForEach-Object -Parallel $generateScript -ThrottleLimit $Parallelization -AsJob + + $job | Wait-Job -Timeout 1200 + $job | Receive-Job + + Remove-Item ./specs -Recurse -Force + + Copy-Item -Path ./tsp-output/*/src -Destination ./ -Recurse -Force -Exclude @("ReadmeSamples.java", "module-info.java") + + Remove-Item ./tsp-output -Recurse -Force + + if ($ExitCode -ne 0) { + throw "Failed to generate from tsp" + } +} finally { + Pop-Location +} diff --git a/packages/typespec-java/emitter-tests/Setup.ps1 b/packages/typespec-java/emitter-tests/Setup.ps1 new file mode 100644 index 0000000000..d175ed954e --- /dev/null +++ b/packages/typespec-java/emitter-tests/Setup.ps1 @@ -0,0 +1,42 @@ +param ( + # skip the emitter build and only pack the .tgz; use when the package was + # already built by a prior step (e.g. the repo-wide `pnpm build` in CI) to + # avoid a redundant second build. The pack step still runs because the .tgz + # is not produced by the regular build. + [switch] $SkipBuild = $false +) + +Set-Location $PSScriptRoot + +Push-Location .. +try { + if ($SkipBuild) { + # Already built; just pack the .tgz that emitter-tests installs. + pnpm pack --pack-destination . + if ($LASTEXITCODE -ne 0) { + exit $LASTEXITCODE + } + } else { + ./Build-TypeSpec.ps1 + } +} finally { + Pop-Location +} + +if (Test-Path node_modules) { + Remove-Item node_modules -Recurse -Force +} + +if (Test-Path package-lock.json) { + Remove-Item package-lock.json +} + +# typespec-tests references typespec-java via a local file path. +# npm ci will fail when the hash of the package is different from the one in package-lock.json. +# To avoid this, we remove package-lock.json and run npm install instead. +npm install + +# delete output +if (Test-Path tsp-output) { + Remove-Item tsp-output -Recurse -Force +} diff --git a/packages/typespec-java/emitter-tests/Spector-Tests.ps1 b/packages/typespec-java/emitter-tests/Spector-Tests.ps1 new file mode 100644 index 0000000000..8b40b33b51 --- /dev/null +++ b/packages/typespec-java/emitter-tests/Spector-Tests.ps1 @@ -0,0 +1,38 @@ +#Requires -Version 7.0 + +# Run the Spector tests for @azure-tools/typespec-java. +# +# Prerequisite: the SDK has been regenerated via ./Generate.ps1 (which builds the +# emitter, installs this project, and regenerates src/main/java from the spector +# specs). This starts the Spector mock server, compiles and runs the JUnit tests +# against the generated SDK, then stops the server. + +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version 3.0 + +Set-Location $PSScriptRoot + +Write-Host "Starting the Spector server" +npm run spector-start + +try { + Write-Host "Compile and run the tests" + mvn clean test --no-transfer-progress -T 1C + if ($LASTEXITCODE -ne 0) { + throw "Spector tests failed" + } +} +finally { + Write-Host "Stopping the Spector server" + npm run spector-stop + + # Stage the coverage report where the ADO upload-spector-coverage.yml template + # expects it: /node_modules/@azure-tools/azure-http-specs/spec-coverage.json. + $coverageSource = "./tsp-spector-coverage-java.json" + $coverageDest = "./node_modules/@azure-tools/azure-http-specs/spec-coverage.json" + if (Test-Path $coverageSource) { + Copy-Item $coverageSource $coverageDest -Force + } +} + +Write-Host "Finished running the Spector tests" diff --git a/packages/typespec-java/emitter-tests/SyncTests.ps1 b/packages/typespec-java/emitter-tests/SyncTests.ps1 new file mode 100644 index 0000000000..449558fa24 --- /dev/null +++ b/packages/typespec-java/emitter-tests/SyncTests.ps1 @@ -0,0 +1,22 @@ +# Sync the hand-written tests (src) and TypeSpec specs (tsp) from the upstream +# http-client-generator-test in the core/ submodule, the source of truth for the +# Java test suite. +# +# NOTE: customization/ is intentionally NOT synced -- those classes are the +# Azure-specific port (com.azure.autorest.customization) maintained in this repo, +# whereas core's customization uses the unbranded base. +# +# Generated output (src/main, **/generated/**) is gitignored; only the +# hand-written tests and specs synced here are committed. + +$ErrorActionPreference = "Stop" +Set-Location $PSScriptRoot + +$testRoot = Resolve-Path (Join-Path ".." ".." ".." "core" "packages" "http-client-java" "generator" "http-client-generator-test") + +Remove-Item ./src -Recurse -Force -ErrorAction SilentlyContinue +Remove-Item ./tsp -Recurse -Force -ErrorAction SilentlyContinue +Copy-Item -Path (Join-Path $testRoot "src") -Destination ./src -Recurse -Force +Copy-Item -Path (Join-Path $testRoot "tsp") -Destination ./tsp -Recurse -Force + +Write-Host "Synced src and tsp from $testRoot" diff --git a/packages/typespec-java/emitter-tests/customization/pom.xml b/packages/typespec-java/emitter-tests/customization/pom.xml new file mode 100644 index 0000000000..e6b36bb6a0 --- /dev/null +++ b/packages/typespec-java/emitter-tests/customization/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + + Microsoft Autorest TypeSpec Tests code customization + This package contains code for Microsoft Autorest TypeSpec Tests code customization + + com.azure.tools + azure-typespec-tests-autorest-customization + 1.0.0-beta.1 + jar + + + + com.azure.tools + azure-autorest-customization + 1.0.0-beta.11 + + + diff --git a/packages/typespec-java/emitter-tests/customization/src/main/java/CustomizationTest.java b/packages/typespec-java/emitter-tests/customization/src/main/java/CustomizationTest.java new file mode 100644 index 0000000000..8037e4c89b --- /dev/null +++ b/packages/typespec-java/emitter-tests/customization/src/main/java/CustomizationTest.java @@ -0,0 +1,25 @@ +import com.azure.autorest.customization.Customization; +import com.azure.autorest.customization.LibraryCustomization; +import com.github.javaparser.javadoc.JavadocBlockTag; +import com.github.javaparser.javadoc.description.JavadocDescription; +import org.slf4j.Logger; + +/** + * This class contains the customization code to customize the AutoRest generated code for App Configuration. + */ +public class CustomizationTest extends Customization { + + @Override + public void customize(LibraryCustomization customization, Logger logger) { + logger.info("Customizing the NamingClient javadoc"); + customization.getClass("tsptest.naming", "NamingClient").customizeAst(ast -> ast.getClassByName("NamingClient") + .ifPresent(clazz -> clazz.getMethodsByName("postWithResponse").forEach(method -> method.getJavadoc() + .ifPresent(javadoc -> { + javadoc.getDescription().getElements().clear(); + javadoc.getDescription().getElements() + .addAll(JavadocDescription.parseText("Protocol method for POST operation.").getElements()); + javadoc.getBlockTags().removeIf(tag -> tag.getType() == JavadocBlockTag.Type.UNKNOWN); + method.setJavadocComment(javadoc); + })))); + } +} diff --git a/packages/typespec-java/emitter-tests/customization/src/main/java/KeyVaultCustomization.java b/packages/typespec-java/emitter-tests/customization/src/main/java/KeyVaultCustomization.java new file mode 100644 index 0000000000..a5f299d61a --- /dev/null +++ b/packages/typespec-java/emitter-tests/customization/src/main/java/KeyVaultCustomization.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import com.azure.autorest.customization.ClassCustomization; +import com.azure.autorest.customization.Customization; +import com.azure.autorest.customization.LibraryCustomization; +import com.azure.autorest.customization.PackageCustomization; +import com.github.javaparser.ast.type.ClassOrInterfaceType; +import org.slf4j.Logger; + +public class KeyVaultCustomization extends Customization { + @Override + public void customize(LibraryCustomization customization, Logger logger) { + PackageCustomization modelsPackage = customization.getPackage("tsptest.armcustomization.fluent.models"); + + customizeBaseResource(modelsPackage.getClass("VaultInner")); + } + + private void customizeBaseResource(ClassCustomization customization) { + customization.customizeAst(ast -> { + ast.getClassByName(customization.getClassName()).ifPresent(clazz -> { + String resourceClassName = "com.azure.core.management.Resource"; + ast.addImport(resourceClassName); + clazz.getExtendedTypes().clear(); + clazz.addExtendedType(new ClassOrInterfaceType(null, "Resource")); + }); + }); + } +} diff --git a/packages/typespec-java/emitter-tests/package.json b/packages/typespec-java/emitter-tests/package.json new file mode 100644 index 0000000000..4a5f0e3a7c --- /dev/null +++ b/packages/typespec-java/emitter-tests/package.json @@ -0,0 +1,44 @@ +{ + "name": "@azure-tools/typespec-java-tests", + "version": "0.1.0", + "type": "module", + "scripts": { + "format": "npm run -s prettier -- --write", + "check-format": "npm run prettier -- --check", + "prettier": "prettier --config ./.prettierrc.yaml **/*.tsp", + "regenerate": "pwsh ./Generate.ps1", + "test:java:e2e": "pwsh ./Spector-Tests.ps1", + "spector-serve": "tsp-spector serve ./node_modules/@typespec/http-specs/specs ./node_modules/@azure-tools/azure-http-specs/specs --coverageFile ./tsp-spector-coverage-java.json", + "spector-start": "tsp-spector server start ./node_modules/@typespec/http-specs/specs ./node_modules/@azure-tools/azure-http-specs/specs --coverageFile ./tsp-spector-coverage-java.json", + "spector-stop": "tsp-spector server stop" + }, + "dependencies": { + "@typespec/spec-api": "0.1.0-alpha.14", + "@typespec/spector": "0.1.0-alpha.25", + "@typespec/http-specs": "0.1.0-alpha.38", + "@azure-tools/azure-http-specs": "0.1.0-alpha.42", + "@azure-tools/typespec-java": "file:../azure-tools-typespec-java-0.45.4.tgz" + }, + "devDependencies": { + "@typespec/prettier-plugin-typespec": "^1.13.0", + "prettier-plugin-organize-imports": "^4.3.0", + "prettier": "^3.8.4" + }, + "overrides": { + "@typespec/compiler": "1.13.0", + "@typespec/http": "1.13.0", + "@typespec/rest": "0.83.0", + "@typespec/versioning": "0.83.0", + "@typespec/openapi": "1.13.0", + "@typespec/xml": "0.83.0", + "@typespec/events": "0.83.0", + "@typespec/sse": "0.83.0", + "@typespec/streams": "0.83.0", + "@azure-tools/typespec-azure-core": "0.69.0", + "@azure-tools/typespec-client-generator-core": "0.69.0", + "@azure-tools/typespec-azure-resource-manager": "0.69.1", + "@azure-tools/typespec-autorest": "0.69.1", + "@azure-tools/typespec-liftr-base": "0.14.0" + }, + "private": true +} diff --git a/packages/typespec-java/emitter-tests/pom.xml b/packages/typespec-java/emitter-tests/pom.xml new file mode 100644 index 0000000000..a24386eb77 --- /dev/null +++ b/packages/typespec-java/emitter-tests/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + + + com.azure.tools + azure-autorest-parent + 1.0.0-beta.5 + ../pom.xml + + com.azure.tools + azure-typespec-tests + 1.0.0-beta.1 + + + + com.azure + azure-core + + 1.57.1 + + + com.azure + azure-json + 1.5.1 + + + com.azure + azure-xml + 1.2.1 + + + com.azure + azure-identity + 1.18.2 + + + com.azure + azure-core-management + 1.19.3 + + + org.junit.jupiter + junit-jupiter-api + 5.13.4 + test + + + io.projectreactor + reactor-test + 3.7.11 + + + org.mockito + mockito-core + 4.11.0 + test + + + + + net.bytebuddy + byte-buddy + 1.17.7 + test + + + net.bytebuddy + byte-buddy-agent + 1.17.7 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-core-http-jdk-httpclient + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.11.3 + + 1.8 + Azure SDK for Java Reference Documentation + Azure SDK for Java Reference Documentation + Visit the <a href="https://docs.microsoft.com/java/azure/">Azure for Java Developers</a> site + for more Java documentation, including quick starts, tutorials, and code samples. + + false + + *.impl*: + *.implementation: + *.implementation*: + *.samples: + com.azure.tools.checkstyle*: + com.azure.core.test*: + com.azure.json,com.azure.core.* + + + module-info.java + + true + true + all + true + ${packageOutputDirectory} + + + + + diff --git a/packages/typespec-java/emitter-tests/readme.md b/packages/typespec-java/emitter-tests/readme.md new file mode 100644 index 0000000000..38a79c5136 --- /dev/null +++ b/packages/typespec-java/emitter-tests/readme.md @@ -0,0 +1,84 @@ +# Test @azure-tools/typespec-java + +This project regenerates and tests `@azure-tools/typespec-java` (the branded Java emitter built in +the parent `@azure-tools/typespec-java` package (`..`)) against the [http-specs] and [azure-http-specs] Spector +suites and a set of local TypeSpec sources under [`tsp/`](./tsp). + +It is a standalone npm + Maven project and is intentionally **not** part of the pnpm workspace. It +consumes the emitter via the packed `.tgz` produced by `../Build-TypeSpec.ps1`. + +## Prerequisite + +Install [Node.js](https://nodejs.org/en/download/) 22 or above. (Verify by running `node --version`) + +Install [Java](https://docs.microsoft.com/java/openjdk/download) 11 or above. (Verify by running `java --version`) + +Install [Maven](https://maven.apache.org/download.cgi). (Verify by running `mvn --version`) + +## Build emitter, install, and generate code + +Run from this (`emitter-tests`) folder: + +```pwsh +pwsh ./Generate.ps1 +``` + +`Generate.ps1` calls `Setup.ps1` (which builds the emitter jar + `.tgz` via +`../Build-TypeSpec.ps1` and `npm install`s it here), then regenerates the SDK from the local +`tsp/` sources and the [http-specs]/[azure-http-specs] specs into the (gitignored) `src/main/java` +folder. This takes a while. + +To only (re)build and install the emitter without regenerating, run `pwsh ./Setup.ps1`. + +## Run the Spector tests + +```pwsh +pwsh ./Spector-Tests.ps1 +``` + +This starts the `tsp-spector` mock server, runs the JUnit tests (`mvn clean test`) against the +generated SDK, then stops the server. It also writes `tsp-spector-coverage-java.json`. + +To start/stop the mock server manually (for example to run individual tests from your IDE): + +```shell +npm run spector-start # or: npm run spector-serve (foreground) +npm run spector-stop +``` + +## Sync hand-written tests and specs from core + +The hand-written JUnit tests under `src/test/java` and the local specs under `tsp/` are synced from +the unbranded test project in the `core/` submodule +(`core/packages/http-client-java/http-client-generator-test`). Refresh them with: + +```pwsh +pwsh ./SyncTests.ps1 +``` + +The Azure-specific customization classes under `customization/` are hand-maintained here and are +**not** synced from core. + +## Generate code for a single TypeSpec source + +```shell +npx tsp compile +``` + +Useful for a quick check that a change to the emitter behaves as expected. Generated code is written +to `tsp-output/` for inspection. + +## Troubleshooting + +### New version of `@typespec/compiler` etc. + +Force a clean install by deleting `node_modules` and `package-lock.json`, then re-run `Setup.ps1`: + +```shell +rm -rf node_modules +rm package-lock.json +``` + +[http-specs]: https://github.com/microsoft/typespec/tree/main/packages/http-specs +[azure-http-specs]: https://github.com/Azure/typespec-azure/tree/main/packages/azure-http-specs + diff --git a/packages/typespec-java/emitter-tests/setup.py b/packages/typespec-java/emitter-tests/setup.py new file mode 100644 index 0000000000..5841effbb0 --- /dev/null +++ b/packages/typespec-java/emitter-tests/setup.py @@ -0,0 +1,7 @@ +import subprocess +import sys + +# A python wrapper to call the PowerShell Setup.ps1 script +p = subprocess.Popen(["pwsh", ".\Setup.ps1"], stdout=sys.stdout) +p.communicate() +print("Setup complete") diff --git a/packages/typespec-java/emitter-tests/src/test/java/authentication/apikey/ApiKeyTests.java b/packages/typespec-java/emitter-tests/src/test/java/authentication/apikey/ApiKeyTests.java new file mode 100644 index 0000000000..2e2ed21eb4 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/authentication/apikey/ApiKeyTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package authentication.apikey; + +import authentication.util.AzureKeyCredentialPolicy; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.exception.HttpResponseException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ApiKeyTests { + + @Test + public void testValid() { + ApiKeyAsyncClient client = new ApiKeyClientBuilder() + // AzureKeyCredentialPolicy from core requires HTTPS + .addPolicy(new AzureKeyCredentialPolicy("x-ms-api-key", new AzureKeyCredential("valid-key"))) + .buildAsyncClient(); + + client.valid().block(); + } + + @Test + public void testInvalid() { + ApiKeyClient client = new ApiKeyClientBuilder() + // AzureKeyCredentialPolicy from core requires HTTPS + .addPolicy(new AzureKeyCredentialPolicy("x-ms-api-key", new AzureKeyCredential("invalid-key"))) + .buildClient(); + + // assert HttpResponseException + Assertions.assertThrows(HttpResponseException.class, client::invalid); + // assert statusCode 403 + try { + client.invalid(); + } catch (HttpResponseException e) { + Assertions.assertEquals(403, e.getResponse().getStatusCode()); + } + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/authentication/http/custom/CustomAuthTests.java b/packages/typespec-java/emitter-tests/src/test/java/authentication/http/custom/CustomAuthTests.java new file mode 100644 index 0000000000..27d8177892 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/authentication/http/custom/CustomAuthTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package authentication.http.custom; + +import authentication.util.AzureKeyCredentialPolicy; +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.exception.HttpResponseException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class CustomAuthTests { + + @Test + public void testValid() { + CustomAsyncClient client = new CustomClientBuilder() + // AzureKeyCredentialPolicy from core requires HTTPS + .addPolicy( + new AzureKeyCredentialPolicy("authorization", new AzureKeyCredential("valid-key"), "SharedAccessKey")) + .buildAsyncClient(); + + client.valid().block(); + } + + @Test + public void testInvalid() { + CustomClient client = new CustomClientBuilder() + // AzureKeyCredentialPolicy from core requires HTTPS + .addPolicy( + new AzureKeyCredentialPolicy("authorization", new AzureKeyCredential("invalid-key"), "SharedAccessKey")) + .buildClient(); + + // assert HttpResponseException + Assertions.assertThrows(HttpResponseException.class, client::invalid); + // assert statusCode 403 + try { + client.invalid(); + } catch (HttpResponseException e) { + Assertions.assertEquals(403, e.getResponse().getStatusCode()); + } + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/authentication/noauth/union/UnionTests.java b/packages/typespec-java/emitter-tests/src/test/java/authentication/noauth/union/UnionTests.java new file mode 100644 index 0000000000..52befe08b4 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/authentication/noauth/union/UnionTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package authentication.noauth.union; + +import authentication.util.BearerTokenAuthenticationPolicy; +import com.azure.core.credential.AccessToken; +import com.azure.core.exception.HttpResponseException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public class UnionTests { + + private static final String EXPECTED_TOKEN = "https://security.microsoft.com/.default"; + + private static UnionClientBuilder createClientBuilder() { + return new UnionClientBuilder(); + } + + private static BearerTokenAuthenticationPolicy createBearerPolicy() { + return new BearerTokenAuthenticationPolicy( + tokenRequestContext -> Mono.just(new AccessToken(EXPECTED_TOKEN, OffsetDateTime.now().plusHours(1)))); + } + + @Test + public void validNoAuthAllowsRequestsWithoutAuthentication() { + UnionClient client = createClientBuilder().buildClient(); + + Assertions.assertDoesNotThrow(() -> client.validNoAuth()); + } + + @Test + public void validTokenFailsWhenAuthorizationMissing() { + UnionClient client = createClientBuilder().buildClient(); + + Assertions.assertThrows(HttpResponseException.class, client::validToken); + } + + @Test + public void validTokenSucceedsWithBearerToken() { + UnionClient client = createClientBuilder().addPolicy(createBearerPolicy()).buildClient(); + + Assertions.assertDoesNotThrow(() -> client.validToken()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/authentication/oauth2/OAuth2Tests.java b/packages/typespec-java/emitter-tests/src/test/java/authentication/oauth2/OAuth2Tests.java new file mode 100644 index 0000000000..806e744a6d --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/authentication/oauth2/OAuth2Tests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package authentication.oauth2; + +import authentication.util.BearerTokenAuthenticationPolicy; +import com.azure.core.credential.AccessToken; +import com.azure.core.exception.HttpResponseException; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public class OAuth2Tests { + + private static OAuth2Client buildClient() { + return new OAuth2ClientBuilder() + // not able to use azure-identity in this test. + .addPolicy(new BearerTokenAuthenticationPolicy(tokenRequestContext -> Mono + .just(new AccessToken("https://security.microsoft.com/.default", OffsetDateTime.now().plusHours(1))))) + .buildClient(); + } + + @Test + public void testValid() { + OAuth2Client client = buildClient(); + + client.valid(); + } + + @Test + public void testInvalid() { + OAuth2Client client = buildClient(); + + // assert HttpResponseException + Assertions.assertThrows(HttpResponseException.class, client::invalid); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/authentication/union/UnionClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/authentication/union/UnionClientTest.java new file mode 100644 index 0000000000..04a3e119b3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/authentication/union/UnionClientTest.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package authentication.union; + +import authentication.util.AzureKeyCredentialPolicy; +import authentication.util.BearerTokenAuthenticationPolicy; +import com.azure.core.credential.AccessToken; +import com.azure.core.credential.AzureKeyCredential; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +class UnionClientTest { + + @Test + void validKey() { + UnionClient client = new UnionClientBuilder() + .addPolicy(new AzureKeyCredentialPolicy("x-ms-api-key", new AzureKeyCredential("valid-key"))) + .buildClient(); + client.validKey(); + } + + @Test + void validToken() { + UnionClient client = new UnionClientBuilder() + .addPolicy(new BearerTokenAuthenticationPolicy(tokenRequestContext -> Mono + .just(new AccessToken("https://security.microsoft.com/.default", OffsetDateTime.now().plusHours(1))))) + .buildClient(); + client.validToken(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/authentication/util/AzureKeyCredentialPolicy.java b/packages/typespec-java/emitter-tests/src/test/java/authentication/util/AzureKeyCredentialPolicy.java new file mode 100644 index 0000000000..66017a8eb5 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/authentication/util/AzureKeyCredentialPolicy.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package authentication.util; + +import com.azure.core.credential.AzureKeyCredential; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpPipelineNextSyncPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.util.logging.ClientLogger; +import java.util.Objects; +import reactor.core.publisher.Mono; + +/** + * Pipeline policy that uses an {@link AzureKeyCredential} to set the authorization key for a request. + *

+ * Requests sent with this pipeline policy are required to use {@code HTTPS}. If the request isn't using {@code HTTPS} + * an exception will be thrown to prevent leaking the key. + */ +public final class AzureKeyCredentialPolicy implements HttpPipelinePolicy { + // AzureKeyCredentialPolicy can be a commonly used policy, use a static logger. + private static final ClientLogger LOGGER + = new ClientLogger(com.azure.core.http.policy.AzureKeyCredentialPolicy.class); + private final HttpHeaderName name; + private final AzureKeyCredential credential; + private final String prefix; + + /** + * Creates a policy that uses the passed {@link AzureKeyCredential} to set the specified header name. + * + * @param name The name of the key header that will be set to {@link AzureKeyCredential#getKey()}. + * @param credential The {@link AzureKeyCredential} containing the authorization key to use. + * @throws NullPointerException If {@code name} or {@code credential} is {@code null}. + * @throws IllegalArgumentException If {@code name} is empty. + */ + public AzureKeyCredentialPolicy(String name, AzureKeyCredential credential) { + this(HttpHeaderName.fromString(name), credential, null); + } + + /** + * Creates a policy that uses the passed {@link AzureKeyCredential} to set the specified header name. + *

+ * The {@code prefix} will be applied before the {@link AzureKeyCredential#getKey()} when setting the header. A + * space will be inserted between {@code prefix} and credential. + * + * @param name The name of the key header that will be set to {@link AzureKeyCredential#getKey()}. + * @param credential The {@link AzureKeyCredential} containing the authorization key to use. + * @param prefix The prefix to apply before the credential, for example "SharedAccessKey credential". + * @throws NullPointerException If {@code name} or {@code credential} is {@code null}. + * @throws IllegalArgumentException If {@code name} is empty. + */ + public AzureKeyCredentialPolicy(String name, AzureKeyCredential credential, String prefix) { + this(HttpHeaderName.fromString(name), Objects.requireNonNull(credential, "'credential' cannot be null."), + prefix); + } + + AzureKeyCredentialPolicy(HttpHeaderName name, AzureKeyCredential credential, String prefix) { + this.name = name; + this.credential = credential; + this.prefix = prefix != null ? prefix.trim() : null; + } + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + setCredential(context.getHttpRequest().getHeaders()); + return next.process(); + } + + @Override + public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next) { + setCredential(context.getHttpRequest().getHeaders()); + return next.processSync(); + } + + void setCredential(HttpHeaders headers) { + String credential = this.credential.getKey(); + headers.set(name, (prefix == null) ? credential : prefix + " " + credential); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/authentication/util/BearerTokenAuthenticationPolicy.java b/packages/typespec-java/emitter-tests/src/test/java/authentication/util/BearerTokenAuthenticationPolicy.java new file mode 100644 index 0000000000..ef1a6119b6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/authentication/util/BearerTokenAuthenticationPolicy.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package authentication.util; + +import com.azure.core.credential.AccessToken; +import com.azure.core.credential.TokenCredential; +import com.azure.core.credential.TokenRequestContext; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpPipelineNextSyncPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.implementation.AccessTokenCache; +import com.azure.core.util.logging.ClientLogger; +import java.util.Objects; +import reactor.core.publisher.Mono; + +/** + * The pipeline policy that applies a token credential to an HTTP request with "Bearer" scheme. + */ +public class BearerTokenAuthenticationPolicy implements HttpPipelinePolicy { + private static final ClientLogger LOGGER = new ClientLogger(BearerTokenAuthenticationPolicy.class); + private static final String AUTHORIZATION_HEADER = "Authorization"; + private static final String AUTHORIZATION_HEADER_LOWER_CASE = "authorization"; + private static final String BEARER = "Bearer"; + + private final String[] scopes; + private final AccessTokenCache cache; + + /** + * Creates BearerTokenAuthenticationPolicy. + * + * @param credential the token credential to authenticate the request + * @param scopes the scopes of authentication the credential should get token for + */ + public BearerTokenAuthenticationPolicy(TokenCredential credential, String... scopes) { + Objects.requireNonNull(credential); + this.scopes = scopes; + this.cache = new AccessTokenCache(credential); + } + + /** + * Executed before sending the initial request and authenticates the request. + * + * @param context The request context. + * @return A {@link Mono} containing {@link Void} + */ + public Mono authorizeRequest(HttpPipelineCallContext context) { + if (this.scopes == null) { + return Mono.empty(); + } + return setAuthorizationHeaderHelper(context, new TokenRequestContext().addScopes(this.scopes), false); + } + + /** + * Synchronously executed before sending the initial request and authenticates the request. + * + * @param context The request context. + */ + public void authorizeRequestSync(HttpPipelineCallContext context) { + setAuthorizationHeaderHelperSync(context, new TokenRequestContext().addScopes(scopes), false); + } + + /** + * Handles the authentication challenge in the event a 401 response with a WWW-Authenticate authentication challenge + * header is received after the initial request and returns appropriate {@link TokenRequestContext} to be used for + * re-authentication. + * + * @param context The request context. + * @param response The Http Response containing the authentication challenge header. + * @return A {@link Mono} containing {@link TokenRequestContext} + */ + public Mono authorizeRequestOnChallenge(HttpPipelineCallContext context, HttpResponse response) { + return Mono.just(false); + } + + /** + * Handles the authentication challenge in the event a 401 response with a WWW-Authenticate authentication challenge + * header is received after the initial request and returns appropriate {@link TokenRequestContext} to be used for + * re-authentication. + * + * @param context The request context. + * @param response The Http Response containing the authentication challenge header. + * @return A boolean indicating if containing the {@link TokenRequestContext} for re-authentication + */ + public boolean authorizeRequestOnChallengeSync(HttpPipelineCallContext context, HttpResponse response) { + return false; + } + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { +// if ("http".equals(context.getHttpRequest().getUrl().getProtocol())) { +// return Mono.error(new RuntimeException("token credentials require a URL using the HTTPS protocol scheme")); +// } + HttpPipelineNextPolicy nextPolicy = next.clone(); + + return authorizeRequest(context).then(Mono.defer(() -> next.process())).flatMap(httpResponse -> { + String authHeader = httpResponse.getHeaderValue(HttpHeaderName.WWW_AUTHENTICATE); + if (httpResponse.getStatusCode() == 401 && authHeader != null) { + return authorizeRequestOnChallenge(context, httpResponse).flatMap(retry -> { + if (retry) { + // Both Netty and OkHttp expect the requestBody to be closed after the response has been read. + // Failure to do so results in memory leak. + // In case of StreamResponse (or other scenarios where we do not eagerly read the response) + // the response body may not be consumed. + // This can cause potential leaks in the scenarios like above, where the policy + // may intercept the response and it may never be read. + // Forcing the read here - so that the memory can be released. + return httpResponse.getBody().ignoreElements().then(nextPolicy.process()); + } else { + return Mono.just(httpResponse); + } + }); + } + return Mono.just(httpResponse); + }); + } + + @Override + public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next) { +// if ("http".equals(context.getHttpRequest().getUrl().getProtocol())) { +// throw LOGGER.logExceptionAsError( +// new RuntimeException("token credentials require a URL using the HTTPS protocol scheme")); +// } + HttpPipelineNextSyncPolicy nextPolicy = next.clone(); + + authorizeRequestSync(context); + HttpResponse httpResponse = next.processSync(); + String authHeader = httpResponse.getHeaderValue(HttpHeaderName.WWW_AUTHENTICATE); + if (httpResponse.getStatusCode() == 401 && authHeader != null) { + if (authorizeRequestOnChallengeSync(context, httpResponse)) { + // Both Netty and OkHttp expect the requestBody to be closed after the response has been read. + // Failure to do so results in memory leak. + // In case of StreamResponse (or other scenarios where we do not eagerly read the response) + // the response body may not be consumed. + // This can cause potential leaks in the scenarios like above, where the policy + // may intercept the response and it may never be read. + // Forcing the read here - so that the memory can be released. + return nextPolicy.processSync(); + } else { + return httpResponse; + } + } + return httpResponse; + } + + /** + * Authorizes the request with the bearer token acquired using the specified {@code tokenRequestContext} + * + * @param context the HTTP pipeline context. + * @param tokenRequestContext the token request context to be used for token acquisition. + * @return a {@link Mono} containing {@link Void} + */ + public Mono setAuthorizationHeader(HttpPipelineCallContext context, TokenRequestContext tokenRequestContext) { + return setAuthorizationHeaderHelper(context, tokenRequestContext, true); + } + + /** + * Authorizes the request with the bearer token acquired using the specified {@code tokenRequestContext} + * + * @param context the HTTP pipeline context. + * @param tokenRequestContext the token request context to be used for token acquisition. + */ + public void setAuthorizationHeaderSync(HttpPipelineCallContext context, TokenRequestContext tokenRequestContext) { + setAuthorizationHeaderHelperSync(context, tokenRequestContext, true); + } + + private Mono setAuthorizationHeaderHelper(HttpPipelineCallContext context, + TokenRequestContext tokenRequestContext, boolean checkToForceFetchToken) { + return cache.getToken(tokenRequestContext, checkToForceFetchToken).flatMap(token -> { + setAuthorizationHeader(context.getHttpRequest().getHeaders(), token.getToken()); + return Mono.empty(); + }); + } + + private void setAuthorizationHeaderHelperSync(HttpPipelineCallContext context, + TokenRequestContext tokenRequestContext, boolean checkToForceFetchToken) { + AccessToken token = cache.getTokenSync(tokenRequestContext, checkToForceFetchToken); + setAuthorizationHeader(context.getHttpRequest().getHeaders(), token.getToken()); + } + + private static void setAuthorizationHeader(HttpHeaders headers, String token) { +// HttpHeadersHelper.setNoKeyFormatting(headers, AUTHORIZATION_HEADER_LOWER_CASE, AUTHORIZATION_HEADER, +// BEARER + " " + token); + headers.add(HttpHeaderName.AUTHORIZATION, BEARER + " " + token); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/access/AccessTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/access/AccessTests.java new file mode 100644 index 0000000000..33804fb6b6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/access/AccessTests.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.access; + +import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.AbstractModel; +import azure.clientgenerator.core.access.relativemodelinoperation.implementation.models.RealModel; +import azure.clientgenerator.core.access.sharedmodelinoperation.models.SharedModel; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class AccessTests { + + private final PublicOperationClient publicClient = new AccessClientBuilder().buildPublicOperationClient(); + private final InternalOperationClient internalClient = new AccessClientBuilder().buildInternalOperationClient(); + private final SharedModelInOperationClient sharedClient + = new AccessClientBuilder().buildSharedModelInOperationClient(); + private final RelativeModelInOperationClient relativeClient + = new AccessClientBuilder().buildRelativeModelInOperationClient(); + + @Test + public void test() { + publicClient.publicDecoratorInPublic("sample"); + publicClient.noDecoratorInPublic("sample"); + + internalClient.internalDecoratorInInternal("sample"); + internalClient.noDecoratorInInternal("sample"); + internalClient.publicDecoratorInInternal("sample"); + + sharedClient.publicMethod("sample"); + sharedClient.internalWithResponse("sample", null).getValue().toObject(SharedModel.class); + + relativeClient.operation("Madge"); + AbstractModel abstractModel = relativeClient.discriminator("real"); + Assertions.assertInstanceOf(RealModel.class, abstractModel); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/alternatetype/AlternateTypeTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/alternatetype/AlternateTypeTests.java new file mode 100644 index 0000000000..a233b0902f --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/alternatetype/AlternateTypeTests.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.alternatetype; + +import azure.clientgenerator.core.alternatetype.externaltype.models.ModelWithFeatureProperty; +import com.azure.core.models.GeoBoundingBox; +import com.azure.core.models.GeoObject; +import com.azure.core.models.GeoObjectType; +import com.azure.core.models.GeoPoint; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class AlternateTypeTests { + + private final AlternateTypeClient client = new AlternateTypeClientBuilder().buildClient(); + + public static final class GeoFeature extends GeoObject { + + private final GeoObjectType TYPE = GeoObjectType.fromString("Feature"); + private GeoPoint geometry; + private Map properties; + private String id; + + public GeoFeature(GeoBoundingBox boundingBox, Map customProperties) { + super(boundingBox, customProperties); + } + + @Override + public GeoObjectType getType() { + return TYPE; + } + + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", TYPE.toString()); + jsonWriter.writeJsonField("geometry", this.geometry); + jsonWriter.writeMapField("properties", this.properties, JsonWriter::writeUntyped); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + // fromJson is not able to work if de-serialization is invoked via GeoObject + public static GeoObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GeoPoint geometry = null; + Map properties = null; + String id = null; + while (reader.nextToken() != null && reader.currentToken() != com.azure.json.JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + if ("geometry".equals(fieldName)) { + geometry = reader.readObject(GeoPoint::fromJson); + } else if ("properties".equals(fieldName)) { + properties = reader.readMap(JsonReader::readUntyped); + } else if ("id".equals(fieldName)) { + id = reader.getString(); + } else { + reader.skipChildren(); + } + } + GeoFeature feature = new GeoFeature(null, null); + feature.geometry = geometry; + feature.properties = properties; + feature.id = id; + return feature; + }); + } + } + + private static final GeoFeature FEATURE = new GeoFeature(null, null); + static { + FEATURE.id = "feature-1"; + FEATURE.properties = Map.of("name", "A single point of interest", "category", "landmark", "elevation", 100); + FEATURE.geometry = new GeoPoint(-122.25, 37.87); + } + + /** + * The spector test maps GeoFeature to GeoObject, because azure-core does not have GeoFeature class. + * + * Since this 2 classes are not same, in test we cannot directly use GeoObject to pass the test. + * Therefore, + * 1. We had to write a GeoFeature here. + * 2. Invocation in test is not able to de-serialize GeoObject into GeoFeature, as the "fromJson" in GeoObject need + * to know all its child classes. + */ + + @SuppressWarnings("unchecked") + @Test + public void testProperty() { + ModelWithFeatureProperty model = new ModelWithFeatureProperty(FEATURE, "extra"); + client.putProperty(model); + + BinaryData data = client.getPropertyWithResponse(null).getValue(); + Map modelAsMap = (Map) data.toObject(Map.class); + GeoFeature feature = BinaryData.fromObject(modelAsMap.get("feature")).toObject(GeoFeature.class); + Assertions.assertEquals("feature-1", feature.id); + } + + @Test + public void testModel() throws IOException { + client.putModelWithResponse(BinaryData.fromBytes(FEATURE.toJsonBytes()), null); + + BinaryData data = client.getModelWithResponse(null).getValue(); + GeoFeature feature = data.toObject(GeoFeature.class); + Assertions.assertEquals("feature-1", feature.id); + Assertions.assertEquals(3, feature.properties.size()); + Assertions.assertEquals(-122.25, feature.geometry.getCoordinates().getLongitude()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/apiversion/ApiVersionTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/apiversion/ApiVersionTests.java new file mode 100644 index 0000000000..2b4fc29099 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/apiversion/ApiVersionTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.apiversion; + +import azure.clientgenerator.core.apiversion.header.HeaderClient; +import azure.clientgenerator.core.apiversion.header.HeaderClientBuilder; +import azure.clientgenerator.core.apiversion.header.HeaderServiceVersion; +import azure.clientgenerator.core.apiversion.path.PathClient; +import azure.clientgenerator.core.apiversion.path.PathClientBuilder; +import azure.clientgenerator.core.apiversion.path.PathServiceVersion; +import azure.clientgenerator.core.apiversion.query.QueryClient; +import azure.clientgenerator.core.apiversion.query.QueryClientBuilder; +import azure.clientgenerator.core.apiversion.query.QueryServiceVersion; +import org.junit.jupiter.api.Test; + +public class ApiVersionTests { + + @Test + public void headerTests() { + HeaderClient client = new HeaderClientBuilder().serviceVersion(HeaderServiceVersion.getLatest()).buildClient(); + client.headerApiVersion(); + } + + @Test + public void pathTests() { + PathClient client = new PathClientBuilder().serviceVersion(PathServiceVersion.getLatest()).buildClient(); + client.pathApiVersion(); + } + + @Test + public void queryTests() { + QueryClient client = new QueryClientBuilder().serviceVersion(QueryServiceVersion.getLatest()).buildClient(); + client.queryApiVersion(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientdoc/ClientDocTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientdoc/ClientDocTests.java new file mode 100644 index 0000000000..fef27a1024 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientdoc/ClientDocTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientdoc; + +import azure.clientgenerator.core.clientdoc.documentation.models.Plant; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ClientDocTests { + + private final ClientDocClient client = new ClientDocClientBuilder().buildClient(); + + @Test + public void testHarvest() { + Plant response = client.harvest(new Plant("Rose", "Rosa")); + Assertions.assertEquals("Rose", response.getName()); + Assertions.assertEquals("Rosa", response.getSpecies()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/defaultclient/DefaultClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/defaultclient/DefaultClientTests.java new file mode 100644 index 0000000000..80caba42b5 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/defaultclient/DefaultClientTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientinitialization.defaultclient; + +import azure.clientgenerator.core.clientinitialization.defaultclient.models.BlobProperties; +import azure.clientgenerator.core.clientinitialization.defaultclient.models.Input; +import azure.clientgenerator.core.clientinitialization.defaultclient.models.WithBodyRequest; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class DefaultClientTests { + + @Test + public void testHeaderParam() { + HeaderParamClient headerParamClient = new HeaderParamClientBuilder().name("test-name-value").buildClient(); + + headerParamClient.withQuery("test-id"); + headerParamClient.withBody(new Input("test-name")); + } + + @Test + public void testMultipleParams() { + MultipleParamsClient multipleParamsClient + = new MultipleParamsClientBuilder().name("test-name-value").region("us-west").buildClient(); + + multipleParamsClient.withQuery("test-id"); + multipleParamsClient.withBody(new Input("test-name")); + } + + @Test + public void testMixedParams() { + MixedParamsClient mixedParamsClient = new MixedParamsClientBuilder().name("test-name-value").buildClient(); + + mixedParamsClient.withQuery("us-west", "test-id"); + mixedParamsClient.withBody("us-west", new WithBodyRequest("test-name")); + } + + @Test + public void testPathParam() { + PathParamClient pathParamClient = new PathParamClientBuilder().blobName("sample-blob").buildClient(); + + pathParamClient.withQuery("text"); + BlobProperties blobProperties = pathParamClient.getStandalone(); + Assertions.assertNotNull(blobProperties); + Assertions.assertEquals("sample-blob", blobProperties.getName()); + pathParamClient.deleteStandalone(); + } + + @Test + public void testParamAlias() { + ParamAliasClient paramAliasClient = new ParamAliasClientBuilder().blobName("sample-blob").buildClient(); + + paramAliasClient.withAliasedName(); + paramAliasClient.withOriginalName(); + } + + @Test + public void testQueryParam() { + QueryParamClient queryParamClient = new QueryParamClientBuilder().blobName("test-blob").buildClient(); + + queryParamClient.withQuery("text"); + BlobProperties blobProperties = queryParamClient.getStandalone(); + Assertions.assertNotNull(blobProperties); + Assertions.assertEquals("test-blob", blobProperties.getName()); + queryParamClient.deleteStandalone(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/individuallyclient/IndividuallyClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/individuallyclient/IndividuallyClientTests.java new file mode 100644 index 0000000000..02b30166f3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/individuallyclient/IndividuallyClientTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientinitialization.individuallyclient; + +import azure.clientgenerator.core.clientinitialization.individuallyclient.models.BlobProperties; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class IndividuallyClientTests { + + @Test + public void testIndividuallyNestedWithPath() { + IndividuallyNestedWithPathClient client + = new IndividuallyNestedWithPathClientBuilder().blobName("test-blob").buildClient(); + + client.withQuery("text"); + BlobProperties blobProperties = client.getStandalone(); + Assertions.assertNotNull(blobProperties); + Assertions.assertEquals("test-blob", blobProperties.getName()); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyNestedWithQuery() { + IndividuallyNestedWithQueryClient client + = new IndividuallyNestedWithQueryClientBuilder().blobName("test-blob").buildClient(); + + client.withQuery("text"); + BlobProperties blobProperties = client.getStandalone(); + Assertions.assertNotNull(blobProperties); + Assertions.assertEquals("test-blob", blobProperties.getName()); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyNestedWithHeader() { + IndividuallyNestedWithHeaderClient client + = new IndividuallyNestedWithHeaderClientBuilder().name("test-name-value").buildClient(); + + client.withQuery("text"); + client.getStandalone(); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyNestedWithMultiple() { + IndividuallyNestedWithMultipleClient client + = new IndividuallyNestedWithMultipleClientBuilder().name("test-name-value").region("us-west").buildClient(); + + client.withQuery("text"); + client.getStandalone(); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyNestedWithMixed() { + IndividuallyNestedWithMixedClient client + = new IndividuallyNestedWithMixedClientBuilder().name("test-name-value").buildClient(); + + client.withQuery("us-west", "text"); + client.getStandalone("us-west"); + client.deleteStandalone("us-west"); + } + + @Test + public void testIndividuallyNestedWithParamAlias() { + IndividuallyNestedWithParamAliasClient client + = new IndividuallyNestedWithParamAliasClientBuilder().blobName("sample-blob").buildClient(); + + client.withAliasedName(); + client.withOriginalName(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/individuallyparentclient/IndividuallyParentClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/individuallyparentclient/IndividuallyParentClientTests.java new file mode 100644 index 0000000000..18feb0c542 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientinitialization/individuallyparentclient/IndividuallyParentClientTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientinitialization.individuallyparentclient; + +import azure.clientgenerator.core.clientinitialization.individuallyparentclient.models.BlobProperties; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class IndividuallyParentClientTests { + + private final IndividuallyParentClient parentClient = new IndividuallyParentClientBuilder().buildClient(); + + @Test + public void testIndividuallyParentNestedWithPath() { + IndividuallyParentNestedWithPathClient client + = parentClient.getIndividuallyParentNestedWithPathClient("test-blob"); + + client.withQuery("text"); + BlobProperties blobProperties = client.getStandalone(); + Assertions.assertNotNull(blobProperties); + Assertions.assertEquals("test-blob", blobProperties.getName()); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyParentNestedWithQuery() { + IndividuallyParentNestedWithQueryClient client + = parentClient.getIndividuallyParentNestedWithQueryClient("test-blob"); + + client.withQuery("text"); + BlobProperties blobProperties = client.getStandalone(); + Assertions.assertNotNull(blobProperties); + Assertions.assertEquals("test-blob", blobProperties.getName()); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyParentNestedWithHeader() { + IndividuallyParentNestedWithHeaderClient client + = parentClient.getIndividuallyParentNestedWithHeaderClient("test-name-value"); + + client.withQuery("text"); + client.getStandalone(); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyParentNestedWithMultiple() { + IndividuallyParentNestedWithMultipleClient client + = parentClient.getIndividuallyParentNestedWithMultipleClient("test-name-value", "us-west"); + + client.withQuery("text"); + client.getStandalone(); + client.deleteStandalone(); + } + + @Test + public void testIndividuallyParentNestedWithMixed() { + IndividuallyParentNestedWithMixedClient client + = parentClient.getIndividuallyParentNestedWithMixedClient("test-name-value"); + + client.withQuery("us-west", "text"); + client.getStandalone("us-west"); + client.deleteStandalone("us-west"); + } + + @Test + public void testIndividuallyParentNestedWithParamAlias() { + IndividuallyParentNestedWithParamAliasClient client + = parentClient.getIndividuallyParentNestedWithParamAliasClient("sample-blob"); + + client.withAliasedName(); + client.withOriginalName(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/NewSubClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/NewSubClientTests.java new file mode 100644 index 0000000000..0f12a3639b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/NewSubClientTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.newsubclient.ArchiveOperationsClient; +import azure.clientgenerator.core.clientlocation.newsubclient.MoveToNewSubClientBuilder; +import azure.clientgenerator.core.clientlocation.newsubclient.ProductOperationsClient; +import org.junit.jupiter.api.Test; + +public class NewSubClientTests { + + private final MoveToNewSubClientBuilder builder = new MoveToNewSubClientBuilder(); + + @Test + public void testProductOperations() { + ProductOperationsClient productClient = builder.buildProductOperationsClient(); + productClient.listProducts(); + } + + @Test + public void testArchiveOperations() { + ArchiveOperationsClient archiveClient = builder.buildArchiveOperationsClient(); + archiveClient.archiveProduct(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/ParameterTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/ParameterTests.java new file mode 100644 index 0000000000..74a125c815 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/ParameterTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.parameter.MoveMethodParameterToClient; +import azure.clientgenerator.core.clientlocation.parameter.MoveMethodParameterToClientBuilder; +import azure.clientgenerator.core.clientlocation.parameter.models.Blob; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ParameterTests { + + private final MoveMethodParameterToClient client + = new MoveMethodParameterToClientBuilder().storageAccount("testaccount").buildClient(); + + @Test + public void testGetBlob() { + Blob blob = client.getBlob("testcontainer", "testblob.txt"); + Assertions.assertNotNull(blob); + Assertions.assertEquals("blob-001", blob.getId()); + Assertions.assertEquals("testblob.txt", blob.getName()); + Assertions.assertEquals(1024, blob.getSize()); + Assertions.assertEquals("/testcontainer/testblob.txt", blob.getPath()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/RootClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/RootClientTests.java new file mode 100644 index 0000000000..873b80e4b7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/RootClientTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.rootclient.MoveToRootClient; +import azure.clientgenerator.core.clientlocation.rootclient.MoveToRootClientBuilder; +import azure.clientgenerator.core.clientlocation.rootclient.ResourceOperationsClient; +import org.junit.jupiter.api.Test; + +public class RootClientTests { + + private final MoveToRootClientBuilder builder = new MoveToRootClientBuilder(); + + @Test + public void testRootClient() { + MoveToRootClient rootClient = builder.buildClient(); + rootClient.getHealthStatus(); + } + + @Test + public void testResourceOperations() { + ResourceOperationsClient resourceClient = builder.buildResourceOperationsClient(); + resourceClient.getResource(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/SubClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/SubClientTests.java new file mode 100644 index 0000000000..cb939990e7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/clientlocation/SubClientTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.clientlocation; + +import azure.clientgenerator.core.clientlocation.subclient.AdminOperationsClient; +import azure.clientgenerator.core.clientlocation.subclient.MoveToExistingSubClientBuilder; +import azure.clientgenerator.core.clientlocation.subclient.UserOperationsClient; +import org.junit.jupiter.api.Test; + +public class SubClientTests { + + private final MoveToExistingSubClientBuilder builder = new MoveToExistingSubClientBuilder(); + + @Test + public void testAdminOperations() { + AdminOperationsClient adminClient = builder.buildAdminOperationsClient(); + adminClient.getAdminInfo(); + adminClient.deleteUser(); + } + + @Test + public void testUserOperations() { + UserOperationsClient userClient = builder.buildUserOperationsClient(); + userClient.getUser(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullTests.java new file mode 100644 index 0000000000..cd26321a22 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/deserialize/emptystringnull/DeserializeEmptyStringAsNullTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.deserialize.emptystringnull; + +import azure.clientgenerator.core.deserialize.emptystringnull.models.ResponseModel; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class DeserializeEmptyStringAsNullTests { + + private final DeserializeEmptyStringAsNullClient client + = new DeserializeEmptyStringAsNullClientBuilder().buildClient(); + + @Test + public void testDeserializeEmptyStringAsNull() { + ResponseModel model = client.get(); + Assertions.assertEquals("", model.getSampleUrl()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/exactname/ExactNameTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/exactname/ExactNameTests.java new file mode 100644 index 0000000000..1e692e2388 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/exactname/ExactNameTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.exactname; + +import azure.clientgenerator.core.exactname.enumvalue.models.AgentEndpointProtocol; +import azure.clientgenerator.core.exactname.enumvalue.models.EndpointConfig; +import azure.clientgenerator.core.exactname.model.models.my_model; +import azure.clientgenerator.core.exactname.property.models.ScopedModel; +import java.lang.reflect.Method; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ExactNameTests { + + private final ModelClient modelClient = new ExactNameClientBuilder().buildModelClient(); + private final PropertyClient propertyClient = new ExactNameClientBuilder().buildPropertyClient(); + private final EnumValueClient enumValueClient = new ExactNameClientBuilder().buildEnumValueClient(); + private final OperationClient operationClient = new ExactNameClientBuilder().buildOperationClient(); + private final ParameterClient parameterClient = new ExactNameClientBuilder().buildParameterClient(); + + @Test + public void testModelExactName() { + my_model response = modelClient.send(new my_model("test")); + Assertions.assertEquals("test", response.getName()); + Assertions.assertEquals("my_model", my_model.class.getSimpleName()); + } + + @Test + public void testPropertyExactName() throws NoSuchMethodException { + ScopedModel response = propertyClient.send(new ScopedModel("test")); + Assertions.assertEquals("test", response.get_myName()); + + Method getter = ScopedModel.class.getDeclaredMethod("get_myName"); + Assertions.assertNotNull(getter); + } + + @Test + public void testEnumValueExactName() { + EndpointConfig response = enumValueClient.send(new EndpointConfig(AgentEndpointProtocol.A2A)); + Assertions.assertEquals(AgentEndpointProtocol.A2A, response.getProtocol()); + Assertions.assertEquals("a2a", AgentEndpointProtocol.A2A.toString()); + } + + @Test + public void testOperationAndParameterCalls() { + operationClient.myOp(); + parameterClient.send("hello"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/flattenproperty/FlattenClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/flattenproperty/FlattenClientTests.java new file mode 100644 index 0000000000..b1014971e8 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/flattenproperty/FlattenClientTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.flattenproperty; + +import azure.clientgenerator.core.flattenproperty.models.ChildFlattenModel; +import azure.clientgenerator.core.flattenproperty.models.ChildModel; +import azure.clientgenerator.core.flattenproperty.models.FlattenModel; +import azure.clientgenerator.core.flattenproperty.models.FlattenUnknownModel; +import azure.clientgenerator.core.flattenproperty.models.NestedFlattenModel; +import azure.clientgenerator.core.flattenproperty.models.Solution; +import azure.clientgenerator.core.flattenproperty.models.SolutionProperties; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class FlattenClientTests { + private final FlattenPropertyClient flattenClient = new FlattenPropertyClientBuilder().buildClient(); + + @Test + public void testFlattenModel() { + // flatten is not enabled for data-plane + flattenClient.putFlattenModel(new FlattenModel("foo", new ChildModel("bar", 10))); + flattenClient.putNestedFlattenModel( + new NestedFlattenModel("foo", new ChildFlattenModel("bar", new ChildModel("test", 10)))); + } + + @Test + public void testPutFlattenUnknownModel() { + // flatten is ignored for unknown (non-model) type properties + FlattenUnknownModel result = flattenClient.putFlattenUnknownModel(new FlattenUnknownModel("foo")); + Assertions.assertEquals("test", result.getName()); + Assertions.assertNotNull(result.getProperties()); + } + + @Test + public void testPutFlattenReadOnlyModel() { + // flatten with all read-only properties; input only contains writable fields + Solution result = flattenClient.putFlattenReadOnlyModel(new Solution("foo")); + Assertions.assertEquals("foo", result.getName()); + SolutionProperties properties = result.getProperties(); + Assertions.assertNotNull(properties); + Assertions.assertEquals("solution1", properties.getSolutionId()); + Assertions.assertEquals("Solution Title", properties.getTitle()); + Assertions.assertEquals("Solution Content", properties.getContent()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingTests.java new file mode 100644 index 0000000000..3f26a1ec70 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/hierarchybuilding/HierarchyBuildingTests.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.hierarchybuilding; + +import azure.clientgenerator.core.hierarchybuilding.models.Animal; +import azure.clientgenerator.core.hierarchybuilding.models.Dog; +import azure.clientgenerator.core.hierarchybuilding.models.Pet; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class HierarchyBuildingTests { + + private final AnimalOperationsClient animalClient + = new HierarchyBuildingClientBuilder().buildAnimalOperationsClient(); + private final PetOperationsClient petClient = new HierarchyBuildingClientBuilder().buildPetOperationsClient(); + private final DogOperationsClient dogClient = new HierarchyBuildingClientBuilder().buildDogOperationsClient(); + + @Test + public void testUpdatePetAsAnimal() { + // Test operation that accepts Animal input and returns Animal output + // Service expects Pet data and returns Pet data + Pet inputPet = new Pet("Buddy", true); + Animal response = animalClient.updatePetAsAnimal(inputPet); + + // Verify response is a Pet + Assertions.assertNotNull(response); + Assertions.assertEquals("pet", response.getKind()); + Assertions.assertEquals("Buddy", response.getName()); + + // Verify it's actually a Pet instance (polymorphic deserialization) + Assertions.assertInstanceOf(Pet.class, response); + Pet petResponse = (Pet) response; + Assertions.assertTrue(petResponse.isTrained()); + } + + @Test + public void testUpdateDogAsAnimal() { + // Test operation that accepts Animal input and returns Animal output + // Service expects Dog data and returns Dog data + // Due to @hierarchyBuilding(Pet), Dog should inherit from Pet rather than Animal directly + Dog inputDog = new Dog("Rex", true, "German Shepherd"); + Animal response = animalClient.updateDogAsAnimal(inputDog); + + // Verify response is a Dog + Assertions.assertNotNull(response); + Assertions.assertEquals("dog", response.getKind()); + Assertions.assertEquals("Rex", response.getName()); + + // Verify it's actually a Dog instance (polymorphic deserialization) + Assertions.assertInstanceOf(Dog.class, response); + Dog dogResponse = (Dog) response; + Assertions.assertTrue(dogResponse.isTrained()); + Assertions.assertEquals("German Shepherd", dogResponse.getBreed()); + + // Verify Dog extends Pet (hierarchy building) + Assertions.assertInstanceOf(Pet.class, dogResponse); + } + + @Test + public void testUpdatePetAsPet() { + // Test operation that accepts Pet input and returns Pet output + Pet inputPet = new Pet("Buddy", true); + Pet response = petClient.updatePetAsPet(inputPet); + + // Verify response is a Pet + Assertions.assertNotNull(response); + Assertions.assertEquals("pet", response.getKind()); + Assertions.assertEquals("Buddy", response.getName()); + Assertions.assertTrue(response.isTrained()); + } + + @Test + public void testUpdateDogAsPet() { + // Test operation that accepts Pet input and returns Pet output + // Service expects Dog data and returns Dog data, but through Pet interface + Dog inputDog = new Dog("Rex", true, "German Shepherd"); + Pet response = petClient.updateDogAsPet(inputDog); + + // Verify response is a Dog (polymorphic deserialization) + Assertions.assertNotNull(response); + Assertions.assertEquals("dog", response.getKind()); + Assertions.assertEquals("Rex", response.getName()); + Assertions.assertTrue(response.isTrained()); + + // Verify it's actually a Dog instance + Assertions.assertInstanceOf(Dog.class, response); + Dog dogResponse = (Dog) response; + Assertions.assertEquals("German Shepherd", dogResponse.getBreed()); + } + + @Test + public void testUpdateDogAsDog() { + // Test operation that accepts Dog input and returns Dog output + Dog inputDog = new Dog("Rex", true, "German Shepherd"); + Dog response = dogClient.updateDogAsDog(inputDog); + + // Verify response is a Dog + Assertions.assertNotNull(response); + Assertions.assertEquals("dog", response.getKind()); + Assertions.assertEquals("Rex", response.getName()); + Assertions.assertTrue(response.isTrained()); + Assertions.assertEquals("German Shepherd", response.getBreed()); + + // Verify Dog extends Pet (hierarchy building) + Assertions.assertInstanceOf(Pet.class, response); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/methodoverride/OverrideTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/methodoverride/OverrideTests.java new file mode 100644 index 0000000000..01554712a0 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/methodoverride/OverrideTests.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.methodoverride; + +import azure.clientgenerator.core.methodoverride.models.GroupParametersOptions; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * Test scenarios for client override behavior. + */ +public class OverrideTests { + + @Test + public void testReorderParameters() { + // Verify that after @override the parameters are reordered correctly + // in the client method signature. + // + // Original operation: reorder(@path param2: string, @path param1: string) + // After @override: reorder(@path param1: string, @path param2: string) + // + // Expected path parameter: + // param1: param1 + // param2: param2 + // Expected response: 204 No Content + + ReorderParametersClient client = new OverrideClientBuilder().buildReorderParametersClient(); + + client.reorder("param1", "param2"); + } + + @Test + public void testGroupParameters() { + // Verify that after @override the parameters are grouped correctly + // to GroupParametersOptions in the client method signature. + // + // Original operation: group(@query param1: string, @query param2: string) + // After @override: group(options: GroupParametersOptions) + // + // Expected query parameter: + // param1: param1 + // param2: param2 + // Expected response: 204 No Content + + GroupParametersClient client = new OverrideClientBuilder().buildGroupParametersClient(); + + GroupParametersOptions options = new GroupParametersOptions("param1", "param2"); + client.group(options); + } + + @Test + public void testGroupParametersOptionsModel() { + // Verify the GroupParametersOptions model structure and functionality + GroupParametersOptions options = new GroupParametersOptions("value1", "value2"); + + // Verify the parameters are accessible through getters + Assertions.assertEquals("value1", options.getParam1()); + Assertions.assertEquals("value2", options.getParam2()); + } + + @Test + public void testRequireOptionalParameter() { + RequireOptionalParameterClient client = new OverrideClientBuilder().buildRequireOptionalParameterClient(); + client.requireOptional("param1", "param2"); + } + + @Test + public void testRemoveOptionalParameter() { + RemoveOptionalParameterClient client = new OverrideClientBuilder().buildRemoveOptionalParameterClient(); + client.removeOptional("param1", "param2"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/nextlinkverb/NextLinkPostTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/nextlinkverb/NextLinkPostTests.java new file mode 100644 index 0000000000..f4a25fdbaa --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/nextlinkverb/NextLinkPostTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.nextlinkverb; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NextLinkPostTests { + + private final NextLinkVerbClient client = new NextLinkVerbClientBuilder().buildClient(); + + @Test + public void testNextLinkPost() { + Assertions.assertEquals(2, client.listItems().stream().count()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/responseasbool/ResponseAsBoolTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/responseasbool/ResponseAsBoolTests.java new file mode 100644 index 0000000000..22e9c46ea2 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/responseasbool/ResponseAsBoolTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.responseasbool; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ResponseAsBoolTests { + + private final ResponseAsBoolClient client = new ResponseAsBoolClientBuilder().buildClient(); + + @Test + public void testHeadAsBool() { + Assertions.assertTrue(client.exists()); + Assertions.assertFalse(client.notExists()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/usage/UsageTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/usage/UsageTests.java new file mode 100644 index 0000000000..88cbe1a448 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/clientgenerator/core/usage/UsageTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.clientgenerator.core.usage; + +import azure.clientgenerator.core.usage.models.InputModel; +import azure.clientgenerator.core.usage.models.OrphanModel; +import azure.clientgenerator.core.usage.models.OutputModel; +import azure.clientgenerator.core.usage.models.ResultModel; +import azure.clientgenerator.core.usage.models.RoundTripModel; +import azure.clientgenerator.core.usage.models.models.NamespaceModel; +import com.azure.core.util.BinaryData; +import java.lang.reflect.Constructor; +import java.lang.reflect.Modifier; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class UsageTests { + + private final ModelInOperationClient client = new UsageClientBuilder().buildModelInOperationClient(); + private final NamespaceUsageClient namespaceUsageClient = new UsageClientBuilder().buildNamespaceUsageClient(); + + @Test + public void test() throws NoSuchMethodException { + client.inputToInputOutput(new InputModel("Madge")); + + client.outputToInputOutput(); + + // verify "OutputModel" class has public constructor + Constructor ctorOutputModel = OutputModel.class.getDeclaredConstructor(String.class); + Assertions.assertEquals("public", Modifier.toString(ctorOutputModel.getModifiers())); + + RoundTripModel roundTripModel = client.modelInReadOnlyProperty(new RoundTripModel()); + Assertions.assertEquals("Madge", roundTripModel.getResult().getName()); + // verify "ResultModel" class has private constructor and no setter + Constructor ctorResultModel = ResultModel.class.getDeclaredConstructor(String.class); + Assertions.assertEquals("private", Modifier.toString(ctorResultModel.getModifiers())); + + // verify "OrphanModel" (when made public) can be serialized (and de-serializable as well) to JSON + client.orphanModelSerializableWithResponse(BinaryData.fromObject(new OrphanModel("name", "desc")), null); + + // verify namespace-scoped model can be serialized through namespace usage operation + int statusCode = namespaceUsageClient + .namespaceModelSerializableWithResponse(BinaryData.fromObject(new NamespaceModel("test")), null) + .getStatusCode(); + Assertions.assertEquals(204, statusCode); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/core/basic/CoreTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/core/basic/CoreTests.java new file mode 100644 index 0000000000..15bc3a05b6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/core/basic/CoreTests.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.core.basic; + +import azure.core.basic.models.User; +import azure.core.basic.models.UserList; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.test.http.AssertingHttpClientBuilder; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +public class CoreTests { + + private final BasicAsyncClient client = new BasicClientBuilder() + .httpClient(new AssertingHttpClientBuilder(HttpClient.createDefault()).assertAsync().build()) + .buildAsyncClient(); + + private final BasicClient syncClient = new BasicClientBuilder() + .httpClient(new AssertingHttpClientBuilder(HttpClient.createDefault()).assertSync().build()) + .buildClient(); + + @Test + public void testCreateOrUpdate() { + Map body = new HashMap<>(); + body.put("name", "Madge"); + Mono response = client.createOrUpdate(1, new User().setName("Madge")); + + StepVerifier.create(response).assertNext(user -> { + Assertions.assertEquals(1, user.getId()); + Assertions.assertEquals("Madge", user.getName()); + }).expectComplete().verify(); + } + + @Test + public void testCreateOrReplace() { + Mono response = client.createOrReplace(1, new User().setName("Madge")); + + StepVerifier.create(response).assertNext(user -> { + Assertions.assertEquals(1, user.getId()); + Assertions.assertEquals("Madge", user.getName()); + }).expectComplete().verify(); + } + + @Test + public void testGet() { + Mono response = client.get(1); + + StepVerifier.create(response).assertNext(user -> { + Assertions.assertEquals(1, user.getId()); + Assertions.assertEquals("Madge", user.getName()); + Assertions.assertEquals("11bdc430-65e8-45ad-81d9-8ffa60d55b59", user.getEtag()); + }).expectComplete().verify(); + } + + @Test + public void testList() { + PagedFlux response = client.list(5, 10, Collections.singletonList("id"), "id lt 10", + Arrays.asList("id", "orders", "etag"), Collections.singletonList("orders")); + + StepVerifier.create(response).assertNext(user -> { + Assertions.assertEquals(1, user.getId()); + Assertions.assertEquals("Madge", user.getName()); + Assertions.assertNotNull(user.getEtag()); + Assertions.assertNotNull(user.getOrders()); + }).assertNext(user -> { + Assertions.assertEquals(2, user.getId()); + Assertions.assertEquals("John", user.getName()); + }).expectComplete().verify(); + + } + + @Test + public void testDelete() { + Mono response = client.delete(1); + + StepVerifier.create(response).expectComplete().verify(); + } + + @Test + public void testAction() { + Mono response = client.export(1, "json"); + + StepVerifier.create(response).assertNext(user -> { + Assertions.assertEquals(1, user.getId()); + Assertions.assertEquals("Madge", user.getName()); + }).expectComplete().verify(); + + UserList userList = syncClient.exportAllUsers("json"); + Assertions.assertEquals(2, userList.getUsers().size()); + Assertions.assertEquals("Madge", userList.getUsers().get(0).getName()); + Assertions.assertEquals("John", userList.getUsers().get(1).getName()); + } + + @Test + public void testListSync() { + PagedIterable response = syncClient.list(5, 10, Collections.singletonList("id"), "id lt 10", + Arrays.asList("id", "orders", "etag"), Collections.singletonList("orders")); + + List users = response.stream().collect(Collectors.toList()); + Assertions.assertEquals(2, users.size()); + User user = users.get(0); + Assertions.assertEquals(1, user.getId()); + Assertions.assertEquals("Madge", user.getName()); + Assertions.assertNotNull(user.getEtag()); + Assertions.assertNotNull(user.getOrders()); + + User user1 = users.get(1); + Assertions.assertEquals(2, user1.getId()); + Assertions.assertEquals("John", user1.getName()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/core/lro/rpc/RpcTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/core/lro/rpc/RpcTests.java new file mode 100644 index 0000000000..f30c67e3b3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/core/lro/rpc/RpcTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.core.lro.rpc; + +import azure.core.lro.rpc.models.GenerationOptions; +import azure.core.lro.rpc.models.GenerationResult; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.SyncPoller; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class RpcTests { + + private final RpcClient client = new RpcClientBuilder().buildClient(); + + @Test + public void testRpc() { + SyncPoller poller + = client.beginLongRunningRpc(new GenerationOptions("text")); + + PollResponse response = poller.waitForCompletion(); + + Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus()); + Assertions.assertEquals("operation1", response.getValue().getOperationId()); + Assertions.assertNull(response.getValue().getError()); + + GenerationResult finalResult = poller.getFinalResult(); + Assertions.assertEquals("text data", finalResult.getData()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/core/lro/standard/LroCoreTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/core/lro/standard/LroCoreTests.java new file mode 100644 index 0000000000..e406868280 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/core/lro/standard/LroCoreTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.core.lro.standard; + +import azure.core.lro.standard.models.ExportedUser; +import azure.core.lro.standard.models.User; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.util.BinaryData; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollOperationDetails; +import com.azure.core.util.polling.PollResponse; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class LroCoreTests { + + private final StandardClient client = new StandardClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .buildClient(); + + private final StandardAsyncClient asyncClient = new StandardClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .buildAsyncClient(); + + @Test + public void testPut() { + SyncPoller poller = client.beginCreateOrReplace("madge", new User("contributor")); + + PollResponse response = poller.waitForCompletion(); + Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus()); + + User user = poller.getFinalResult(); + Assertions.assertEquals("madge", user.getName()); + } + + @Test + public void testPutAsync() { + PollerFlux poller + = asyncClient.beginCreateOrReplace("madge", new User("contributor")); + + AsyncPollResponse response = poller.blockLast(); + Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus()); + + User user = response.getFinalResult().block(); + Assertions.assertEquals("madge", user.getName()); + } + + @Test + public void testPutProtocol() { + SyncPoller poller + = client.beginCreateOrReplace("madge", BinaryData.fromObject(new User("contributor")), null); + + PollResponse response = poller.waitForCompletion(); + Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus()); + + BinaryData finalResult = poller.getFinalResult(); + User user = finalResult.toObject(User.class); + Assertions.assertEquals("madge", user.getName()); + } + + @Test + public void testDelete() { + SyncPoller poller = client.beginDelete("madge"); + + PollResponse response = poller.waitForCompletion(); + Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus()); + } + + @Test + public void testPost() { + SyncPoller poller = client.beginExport("madge", "json"); + + PollResponse response = poller.waitForCompletion(); + Assertions.assertEquals(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, response.getStatus()); + + ExportedUser finalResult = poller.getFinalResult(); + Assertions.assertEquals("madge", finalResult.getName()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/core/model/ModelClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/core/model/ModelClientTests.java new file mode 100644 index 0000000000..eeb80fa5fb --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/core/model/ModelClientTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.core.model; + +import azure.core.model.models.AzureEmbeddingModel; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ModelClientTests { + private final ModelClient client = new ModelClientBuilder().buildClient(); + + @Test + public void get() { + Assertions.assertIterableEquals(Arrays.asList(0, 1, 2, 3, 4), client.get()); + } + + @Test + public void post() { + AzureEmbeddingModel model = client.post(new AzureEmbeddingModel(Arrays.asList(0, 1, 2, 3, 4))); + Assertions.assertIterableEquals(Arrays.asList(5, 6, 7, 8, 9), model.getEmbedding()); + } + + @Test + public void put() { + client.put(Arrays.asList(0, 1, 2, 3, 4)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/core/page/PageTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/core/page/PageTests.java new file mode 100644 index 0000000000..65242c9c6c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/core/page/PageTests.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.core.page; + +import azure.core.page.models.ListItemInputBody; +import azure.core.page.models.ListItemInputExtensibleEnum; +import com.azure.core.http.HttpClient; +import com.azure.core.http.netty.NettyAsyncHttpClientProvider; +import com.azure.core.test.http.AssertingHttpClientBuilder; +import com.azure.core.util.HttpClientOptions; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class PageTests { + + private final PageClient client = new PageClientBuilder().httpClient(new AssertingHttpClientBuilder( + HttpClient.createDefault(new HttpClientOptions().setHttpClientProvider(NettyAsyncHttpClientProvider.class))) + .assertSync() + .build()) + .buildClient(); + + @Test + public void testListNoModel() { + // verification here is that there is no Page or CustomPage class generated in models + + client.listWithPage().stream().count(); + + client.listWithCustomPageModel().stream().count(); + } + + @Test + public void testListTwoModels() { + TwoModelsAsPageItemClient client = new PageClientBuilder().buildTwoModelsAsPageItemClient(); + + client.listFirstItem().stream().count(); + + client.listSecondItem().stream().count(); + } + + @Test + public void testPageRequestBody() { + client.listWithParameters(new ListItemInputBody("Madge"), ListItemInputExtensibleEnum.SECOND).stream().count(); + } + + @Test + public void testPageNextLinkReInjectedParameters() { + Assertions.assertEquals(2, client.withParameterizedNextLink("name", true).stream().count()); + } + + @Test + public void testPageWithRelativeNextLink() { + Assertions.assertEquals(2, client.withRelativeNextLink().stream().count()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/core/scalar/ScalarTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/core/scalar/ScalarTests.java new file mode 100644 index 0000000000..b50daae481 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/core/scalar/ScalarTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.core.scalar; + +import azure.core.scalar.models.AzureLocationModel; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ScalarTests { + + private final static String LOCATION_REGION = "eastus"; + private final ScalarClient client = new ScalarClientBuilder().buildClient(); + + @Test + public void testGet() { + Assertions.assertEquals(LOCATION_REGION, client.get()); + } + + @Test + public void testHeader() { + client.headerMethod(LOCATION_REGION); + } + + @Test + public void testPost() { + AzureLocationModel azureLocationModel = client.post(new AzureLocationModel(LOCATION_REGION)); + Assertions.assertEquals(LOCATION_REGION, azureLocationModel.getLocation()); + } + + @Test + public void testPut() { + client.put(LOCATION_REGION); + } + + @Test + public void testQuery() { + client.query(LOCATION_REGION); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/core/traits/TraitsTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/core/traits/TraitsTests.java new file mode 100644 index 0000000000..fbe5d44694 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/core/traits/TraitsTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.core.traits; + +import azure.core.traits.models.UserActionParam; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.RequestConditions; +import com.azure.core.http.rest.Response; +import com.azure.core.util.BinaryData; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class TraitsTests { + + private TraitsClient client = new TraitsClientBuilder().buildClient(); + + @Test + public void testGet() { + OffsetDateTime unmodifiedSince = OffsetDateTime.of(2022, 8, 26, 14, 38, 0, 0, ZoneOffset.UTC); + OffsetDateTime modifiedSince = OffsetDateTime.of(2021, 8, 26, 14, 38, 0, 0, ZoneOffset.UTC); + + client.smokeTest(1, "123", + new RequestConditions().setIfMatch("\"valid\"") + .setIfNoneMatch("\"invalid\"") + .setIfModifiedSince(modifiedSince) + .setIfUnmodifiedSince(unmodifiedSince)); + } + + @Test + public void testPost() { + Response response + = client.repeatableActionWithResponse(1, BinaryData.fromObject(new UserActionParam("test")), null); + Assertions.assertEquals("accepted", + response.getHeaders().getValue(HttpHeaderName.fromString("repeatability-result"))); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/encode/duration/DurationTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/encode/duration/DurationTests.java new file mode 100644 index 0000000000..5c0fdf0a4a --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/encode/duration/DurationTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.encode.duration; + +import azure.encode.duration.models.DurationModel; +import org.junit.jupiter.api.Test; + +public final class DurationTests { + + private final DurationClient client = new DurationClientBuilder().buildClient(); + + @Test + public void testDurationConstant() { + client.durationConstant(new DurationModel("1.02:59:59.5000000")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/example/basic/BasicTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/example/basic/BasicTests.java new file mode 100644 index 0000000000..3dbea06db7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/example/basic/BasicTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.example.basic; + +import azure.example.basic.models.ActionRequest; +import azure.example.basic.models.ActionResponse; +import azure.example.basic.models.Enum; +import azure.example.basic.models.Model; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class BasicTests { + + private final AzureExampleClient client = new AzureExampleClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .buildClient(); + + @Test + public void testBasicActionTests() { + // method invocation + ActionResponse response = client.basicAction("query", "header", + new ActionRequest("text") + .setModelProperty( + new Model().setInt32Property(1).setFloat32Property(1.5D).setEnumProperty(Enum.ENUM_VALUE1)) + .setArrayProperty(List.of("item")) + .setRecordProperty(Map.of("record", "value"))); + + // response assertion + Assertions.assertEquals("text", response.getStringProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/payload/pageable/PageableTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/payload/pageable/PageableTests.java new file mode 100644 index 0000000000..0732efa4df --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/payload/pageable/PageableTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.payload.pageable; + +import azure.payload.pageable.models.User; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.rest.PagedIterable; +import java.util.Arrays; +import java.util.HashSet; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class PageableTests { + + private final PageableClient client = new PageableClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .setAllowedQueryParamNames(new HashSet<>(Arrays.asList("maxpagesize", "skipToken")))) + .buildClient(); + + @Test + public void testPageable() { + PagedIterable pagedIterable = client.list(); + Assertions.assertEquals(4, pagedIterable.streamByPage(3).mapToInt(p -> p.getValue().size()).sum()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/commonproperties/CommonPropertiesTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/commonproperties/CommonPropertiesTests.java new file mode 100644 index 0000000000..11cccea7fb --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/commonproperties/CommonPropertiesTests.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.commonproperties; + +import azure.resourcemanager.commonproperties.models.ApiErrorException; +import azure.resourcemanager.commonproperties.models.ArmResourceIdentifierResource; +import azure.resourcemanager.commonproperties.models.ArmResourceIdentifierResourceProperties; +import azure.resourcemanager.commonproperties.models.ConfidentialResourceProperties; +import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResource; +import azure.resourcemanager.commonproperties.models.ManagedIdentityTrackedResourceProperties; +import azure.resourcemanager.commonproperties.models.ManagedServiceIdentity; +import azure.resourcemanager.commonproperties.models.ManagedServiceIdentityType; +import azure.resourcemanager.commonproperties.models.ResourceProvisioningState; +import azure.resourcemanager.commonproperties.models.UserAssignedIdentity; +import com.azure.core.management.Region; +import com.azure.core.management.exception.ManagementException; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +public class CommonPropertiesTests { + private static final String USER_ASSIGNED_IDENTITIES_KEY + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"; + private final CommonPropertiesManager manager + = CommonPropertiesManager.authenticate(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile()); + + @Test + public void testManagedIdentity() { + Map tagsMap = new HashMap<>(); + tagsMap.put("tagKey1", "tagValue1"); + ManagedIdentityTrackedResource resource = manager.managedIdentities() + .define("identity") + .withRegion(Region.US_EAST) + .withExistingResourceGroup("test-rg") + .withProperties(new ManagedIdentityTrackedResourceProperties()) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .withTags(tagsMap) + .create(); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, resource.identity().type()); + Assertions.assertNotNull(resource.identity().principalId()); + Assertions.assertNotNull(resource.identity().tenantId()); + + resource = manager.managedIdentities().getById(resource.id()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, resource.identity().type()); + Assertions.assertNotNull(resource.identity().principalId()); + Assertions.assertNotNull(resource.identity().tenantId()); + + Map userAssignedIdentityMap = new HashMap<>(); + userAssignedIdentityMap.put(USER_ASSIGNED_IDENTITIES_KEY, new UserAssignedIdentity()); + resource.update() + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(userAssignedIdentityMap)) + .apply(); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, resource.identity().type()); + Assertions.assertNotNull(resource.identity().principalId()); + Assertions.assertNotNull(resource.identity().tenantId()); + Assertions.assertNotNull(resource.identity().userAssignedIdentities()); + Assertions.assertEquals(1, resource.identity().userAssignedIdentities().size()); + UserAssignedIdentity userAssignedIdentity + = resource.identity().userAssignedIdentities().get(USER_ASSIGNED_IDENTITIES_KEY); + Assertions.assertNotNull(userAssignedIdentity.principalId()); + Assertions.assertNotNull(userAssignedIdentity.clientId()); + + } + + @Test + public void testError() { + ApiErrorException apiErrorException = null; + try { + manager.errors() + .define("confidential") + .withRegion(Region.US_EAST) + .withExistingResourceGroup("test-rg") + .withProperties(new ConfidentialResourceProperties().withUsername("00")) + .create(); + } catch (ApiErrorException e) { + apiErrorException = e; + } + Assertions.assertNotNull(apiErrorException); + Assertions.assertEquals("BadRequest", apiErrorException.getValue().getCode()); + Assertions.assertEquals("Username should not contain only numbers.", apiErrorException.getValue().getMessage()); + Assertions.assertEquals("general", apiErrorException.getValue().getInnererror().exceptiontype()); + + ManagementException exception = null; + try { + manager.errors().getByResourceGroup("test-rg", "confidential"); + } catch (ManagementException e) { + exception = e; + } + Assertions.assertNotNull(exception); + Assertions.assertEquals("ResourceNotFound", exception.getValue().getCode()); + } + + @Test + public void testArmResourceIdentifiers() { + final String subscriptionId = "00000000-0000-0000-0000-000000000000"; + final String resourceGroup = "test-rg"; + final String simpleArmId = "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroup + + "/providers/Microsoft.Network/virtualNetworks/myVnet"; + final String armIdWithAllScopes = "/subscriptions/" + subscriptionId + "/resourceGroups/" + resourceGroup + + "/providers/Microsoft.Compute/virtualMachines/myVm"; + + // Create + ArmResourceIdentifierResource resource = manager.armResourceIdentifiers() + .define("armId") + .withRegion(Region.US_EAST) + .withExistingResourceGroup(resourceGroup) + .withProperties(new ArmResourceIdentifierResourceProperties().withSimpleArmId(simpleArmId) + .withArmIdWithType(simpleArmId) + .withArmIdWithTypeAndScope(simpleArmId) + .withArmIdWithAllScopes(armIdWithAllScopes)) + .create(); + Assertions.assertNotNull(resource); + Assertions.assertEquals("armId", resource.name()); + Assertions.assertNotNull(resource.properties()); + Assertions.assertEquals(ResourceProvisioningState.SUCCEEDED, resource.properties().provisioningState()); + Assertions.assertEquals(simpleArmId, resource.properties().simpleArmId()); + Assertions.assertEquals(simpleArmId, resource.properties().armIdWithType()); + Assertions.assertEquals(simpleArmId, resource.properties().armIdWithTypeAndScope()); + Assertions.assertEquals(armIdWithAllScopes, resource.properties().armIdWithAllScopes()); + + // Get + resource = manager.armResourceIdentifiers().getByResourceGroup(resourceGroup, "armId"); + Assertions.assertNotNull(resource); + Assertions.assertEquals("armId", resource.name()); + Assertions.assertNotNull(resource.properties()); + Assertions.assertEquals(ResourceProvisioningState.SUCCEEDED, resource.properties().provisioningState()); + Assertions.assertEquals(simpleArmId, resource.properties().simpleArmId()); + Assertions.assertEquals(armIdWithAllScopes, resource.properties().armIdWithAllScopes()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/largeheader/LargeHeaderTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/largeheader/LargeHeaderTests.java new file mode 100644 index 0000000000..ee2212d6aa --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/largeheader/LargeHeaderTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.largeheader; + +import azure.resourcemanager.largeheader.models.CancelResult; +import com.azure.core.http.HttpPipeline; +import com.azure.core.management.profile.AzureProfile; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Constructor; +import java.time.Duration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +public class LargeHeaderTests { + + @Test + public void testLargeHeader() { + LargeHeaderManager manager = buildManager(); + CancelResult result = manager.largeHeaders().two6k("test-rg", "header1"); + Assertions.assertTrue(result.succeeded()); + } + + // for LRO operations, we need to override default poll interval + private static LargeHeaderManager buildManager() { + try { + Constructor constructor = LargeHeaderManager.class + .getDeclaredConstructor(HttpPipeline.class, AzureProfile.class, Duration.class); + setAccessible(constructor); + return constructor.newInstance(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile(), + Duration.ofMillis(1)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static void setAccessible(final AccessibleObject accessibleObject) { + // avoid bug in Java8 + Runnable runnable = () -> accessibleObject.setAccessible(true); + runnable.run(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/managementgroup/ManagementGroupTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/managementgroup/ManagementGroupTests.java new file mode 100644 index 0000000000..0c5a0e6a8c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/managementgroup/ManagementGroupTests.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.managementgroup; + +import azure.resourcemanager.managementgroup.fluent.models.ManagementGroupChildResourceInner; +import azure.resourcemanager.managementgroup.models.ManagementGroupChildResource; +import azure.resourcemanager.managementgroup.models.ManagementGroupChildResourceProperties; +import azure.resourcemanager.managementgroup.models.ProvisioningState; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +public class ManagementGroupTests { + + private static final String MANAGEMENT_GROUP_ID = "test-mg"; + private static final String RESOURCE_NAME = "resource"; + private static final String RESOURCE_TYPE = "Microsoft.ManagementGroupChild/managementGroupChildResources"; + private static final String RESOURCE_DESCRIPTION_VALID = "valid"; + private static final String RESOURCE_DESCRIPTION_VALID2 = "valid2"; + + private final ManagementGroupManager manager + = ManagementGroupManager.authenticate(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile()); + + @Test + public void testGet() { + ManagementGroupChildResource resource + = manager.managementGroupChildResources().get(MANAGEMENT_GROUP_ID, RESOURCE_NAME); + Assertions.assertNotNull(resource); + Assertions.assertEquals(RESOURCE_NAME, resource.name()); + Assertions.assertEquals(RESOURCE_TYPE, resource.type()); + Assertions.assertNotNull(resource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, resource.properties().description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, resource.properties().provisioningState()); + } + + @Test + public void testCreateOrUpdate() { + ManagementGroupChildResource resource = manager.managementGroupChildResources() + .createOrUpdate(MANAGEMENT_GROUP_ID, RESOURCE_NAME, new ManagementGroupChildResourceInner().withProperties( + new ManagementGroupChildResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID))); + Assertions.assertNotNull(resource); + Assertions.assertEquals(RESOURCE_NAME, resource.name()); + Assertions.assertEquals(RESOURCE_TYPE, resource.type()); + Assertions.assertNotNull(resource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, resource.properties().description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, resource.properties().provisioningState()); + } + + @Test + public void testUpdate() { + ManagementGroupChildResource resource = manager.managementGroupChildResources() + .update(MANAGEMENT_GROUP_ID, RESOURCE_NAME, new ManagementGroupChildResourceInner().withProperties( + new ManagementGroupChildResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID2))); + Assertions.assertNotNull(resource); + Assertions.assertEquals(RESOURCE_NAME, resource.name()); + Assertions.assertNotNull(resource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, resource.properties().description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, resource.properties().provisioningState()); + } + + @Test + public void testDelete() { + manager.managementGroupChildResources().deleteByResourceGroup(MANAGEMENT_GROUP_ID, RESOURCE_NAME); + } + + @Test + public void testListByManagementGroup() { + List resources = manager.managementGroupChildResources() + .listByManagementGroup(MANAGEMENT_GROUP_ID) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, resources.size()); + ManagementGroupChildResource resource = resources.get(0); + Assertions.assertNotNull(resource); + Assertions.assertEquals(RESOURCE_NAME, resource.name()); + Assertions.assertEquals(RESOURCE_TYPE, resource.type()); + Assertions.assertNotNull(resource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, resource.properties().description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, resource.properties().provisioningState()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdTest.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdTest.java new file mode 100644 index 0000000000..b9b6ec4329 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/methodsubscriptionid/MethodSubscriptionIdTest.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.methodsubscriptionid; + +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource1Inner; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResource2Inner; +import azure.resourcemanager.methodsubscriptionid.fluent.models.SubscriptionResourceInner; +import azure.resourcemanager.methodsubscriptionid.models.Operation; +import azure.resourcemanager.methodsubscriptionid.models.OperationDisplay; +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResource; +import azure.resourcemanager.methodsubscriptionid.models.ResourceGroupResourceProperties; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource1Properties; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResource2Properties; +import azure.resourcemanager.methodsubscriptionid.models.SubscriptionResourceProperties; +import com.azure.core.management.Region; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +/** + * Test for ARM method level subscription ID parameter placement. + * + * This test validates that subscriptionId parameters are correctly placed at method level + * vs client level based on @clientLocation decorators in TypeSpec specifications. + * + * Key scenarios tested: + * 1. TwoSubscriptionResourcesMethodLevel: Both subscription resources have subscriptionId as method parameter + * 2. MixedSubscriptionPlacement: Subscription resource has method-level subscriptionId, + * resource group resource uses client-level subscriptionId + */ +public class MethodSubscriptionIdTest { + // Test subscription ID - this will be passed as method parameter for subscription resources + private static final String TEST_SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"; + + // Resource names + private static final String SUBSCRIPTION_RESOURCE_1_NAME = "sub-resource-1"; + private static final String SUBSCRIPTION_RESOURCE_2_NAME = "sub-resource-2"; + private static final String SUBSCRIPTION_RESOURCE_NAME = "sub-resource"; + private static final String RESOURCE_GROUP_RESOURCE_NAME = "rg-resource"; + private static final String RESOURCE_GROUP_NAME = "test-rg"; + + private final MethodSubscriptionIdManager manager + = MethodSubscriptionIdManager.authenticate(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile()); + + @Test + public void testOperationsList() { + List operationList = manager.operations().list().stream().collect(Collectors.toList()); + Assertions.assertFalse(operationList.isEmpty()); + Assertions.assertEquals(1, operationList.size()); + Operation operation = operationList.get(0); + Assertions.assertNotNull(operation); + Assertions.assertEquals("Azure.ResourceManager.MethodSubscriptionId/services/read", operation.name()); + Assertions.assertFalse(operation.isDataAction()); + OperationDisplay display = operation.display(); + Assertions.assertNotNull(display); + Assertions.assertEquals("Azure.ResourceManager.MethodSubscriptionId", display.provider()); + Assertions.assertEquals("services", display.resource()); + Assertions.assertEquals("Lists services", display.operation()); + Assertions.assertEquals("Lists registered services", display.description()); + } + + @Test + public void testTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() { + // Test Scenario 1: Two subscription resources with method-level subscriptionId + // SubscriptionResource1 operations should require subscriptionId as method parameter + + // The key test: verify that get operation requires subscriptionId as method parameter + // This validates that @clientLocation decorator moved subscriptionId to method level + SubscriptionResource1 resource = manager.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .get(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_1_NAME); + + // Verify the resource structure + Assertions.assertNotNull(resource); + Assertions.assertNotNull(resource.name()); + Assertions.assertNotNull(resource.type()); + + // Test delete operation also requires subscriptionId as method parameter + manager.twoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .deleteByResourceGroup(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_1_NAME); + + // TODO: resource define does not take subscriptionId parameter - this is a bug in codegen + // Verify PUT + manager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource1Operations() + .put(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_1_NAME, new SubscriptionResource1Inner().withProperties( + new SubscriptionResource1Properties().withDescription("Valid subscription resource 1"))); + } + + @Test + public void testTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() { + // Test Scenario 1: Two subscription resources with method-level subscriptionId + // SubscriptionResource2 operations should require subscriptionId as method parameter + + SubscriptionResource2 resource = manager.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .get(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_2_NAME); + + Assertions.assertNotNull(resource); + Assertions.assertNotNull(resource.name()); + Assertions.assertNotNull(resource.type()); + + manager.twoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .deleteByResourceGroup(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_2_NAME); + + // TODO: resource define does not take subscriptionId parameter - this is a bug in codegen + // Verify PUT + manager.serviceClient() + .getTwoSubscriptionResourcesMethodLevelSubscriptionResource2Operations() + .put(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_2_NAME, new SubscriptionResource2Inner() + .withProperties(new SubscriptionResource2Properties().withConfigValue("test-config"))); + } + + @Test + public void testMixedSubscriptionPlacementSubscriptionResourceOperations() { + // Test Scenario 2: Mixed placement - subscription resource with method-level subscriptionId + + SubscriptionResource resource = manager.mixedSubscriptionPlacementSubscriptionResourceOperations() + .get(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_NAME); + + Assertions.assertNotNull(resource); + Assertions.assertNotNull(resource.name()); + Assertions.assertNotNull(resource.type()); + + manager.mixedSubscriptionPlacementSubscriptionResourceOperations() + .deleteByResourceGroup(TEST_SUBSCRIPTION_ID, SUBSCRIPTION_RESOURCE_NAME); + + // TODO: resource define does not take subscriptionId parameter - this is a bug in codegen + // Verify PUT + manager.serviceClient() + .getMixedSubscriptionPlacementSubscriptionResourceOperations() + .put(TEST_SUBSCRIPTION_ID, RESOURCE_GROUP_RESOURCE_NAME, new SubscriptionResourceInner() + .withProperties(new SubscriptionResourceProperties().withSubscriptionSetting("test-sub-setting"))); + } + + @Test + public void testMixedSubscriptionPlacementResourceGroupResourceOperations() { + // Test Scenario 2: Mixed placement - resource group resource with client-level subscriptionId + // This resource should NOT require subscriptionId as method parameter (uses client-level) + + // Key test: getByResourceGroup does NOT take subscriptionId parameter + // The subscriptionId comes from the client-level (manager configuration) + ResourceGroupResource resource = manager.mixedSubscriptionPlacementResourceGroupResourceOperations() + .getByResourceGroup(RESOURCE_GROUP_NAME, RESOURCE_GROUP_RESOURCE_NAME); + + Assertions.assertNotNull(resource); + Assertions.assertNotNull(resource.name()); + Assertions.assertNotNull(resource.type()); + Assertions.assertNotNull(resource.region()); + + // Key test: deleteByResourceGroup does NOT take subscriptionId parameter + manager.mixedSubscriptionPlacementResourceGroupResourceOperations() + .deleteByResourceGroup(RESOURCE_GROUP_NAME, RESOURCE_GROUP_RESOURCE_NAME); + + // Verify PUT + manager.mixedSubscriptionPlacementResourceGroupResourceOperations() + .define(RESOURCE_GROUP_RESOURCE_NAME) + .withRegion(Region.US_EAST) + .withExistingResourceGroup(RESOURCE_GROUP_NAME) + .withProperties(new ResourceGroupResourceProperties().withResourceGroupSetting("test-setting")) + .create(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/multiservice/ArmMultipleServiceTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/multiservice/ArmMultipleServiceTests.java new file mode 100644 index 0000000000..690005694e --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/multiservice/ArmMultipleServiceTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.multiservice; + +import azure.resourcemanager.multiservice.combined.CombinedManager; +import azure.resourcemanager.multiservice.combined.models.DiskProperties; +import azure.resourcemanager.multiservice.combined.models.VirtualMachineProperties; +import com.azure.core.management.Region; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +public final class ArmMultipleServiceTests { + + private final CombinedManager manager + = CombinedManager.authenticate(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile()); + + private static final String RESOURCE_GROUP_NAME = "test-rg"; + private static final Region REGION = Region.US_EAST; + + @Test + public void testCombinedClient() { + manager.disks() + .define("disk1") + .withRegion(REGION) + .withExistingResourceGroup(RESOURCE_GROUP_NAME) + .withProperties(new DiskProperties()) + .create(); + manager.disks().getByResourceGroup(RESOURCE_GROUP_NAME, "disk1"); + + manager.virtualMachines() + .define("vm1") + .withRegion(REGION) + .withExistingResourceGroup(RESOURCE_GROUP_NAME) + .withProperties(new VirtualMachineProperties()) + .create(); + manager.virtualMachines().getByResourceGroup(RESOURCE_GROUP_NAME, "vm1"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/multiservicesharedmodels/ArmMultiServiceSharedModelsTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/multiservicesharedmodels/ArmMultiServiceSharedModelsTests.java new file mode 100644 index 0000000000..9258aa5d4f --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/multiservicesharedmodels/ArmMultiServiceSharedModelsTests.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.multiservicesharedmodels; + +import azure.resourcemanager.multiservicesharedmodels.combined.CombinedManager; +import azure.resourcemanager.multiservicesharedmodels.combined.models.SharedMetadata; +import azure.resourcemanager.multiservicesharedmodels.combined.models.StorageAccountProperties; +import azure.resourcemanager.multiservicesharedmodels.combined.models.VirtualMachineProperties; +import com.azure.core.management.Region; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +public final class ArmMultiServiceSharedModelsTests { + + private final CombinedManager manager + = CombinedManager.authenticate(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile()); + + private static final String RESOURCE_GROUP_NAME = "test-rg"; + private static final Region REGION_STORAGE = Region.US_WEST; + private static final Region REGION_VM = Region.US_EAST; + + @Test + public void testCombinedClient() { + Map storageTags = new HashMap<>(); + storageTags.put("department", "engineering"); + SharedMetadata storageMetadata = new SharedMetadata().withCreatedBy("admin@example.com").withTags(storageTags); + + manager.storageAccounts() + .define("account1") + .withRegion(REGION_STORAGE) + .withExistingResourceGroup(RESOURCE_GROUP_NAME) + .withProperties(new StorageAccountProperties().withMetadata(storageMetadata)) + .create(); + manager.storageAccounts().getByResourceGroup(RESOURCE_GROUP_NAME, "account1"); + + Map vmTags = new HashMap<>(); + vmTags.put("environment", "production"); + SharedMetadata vmMetadata = new SharedMetadata().withCreatedBy("user@example.com").withTags(vmTags); + + manager.virtualMachines() + .define("vm-shared1") + .withRegion(REGION_VM) + .withExistingResourceGroup(RESOURCE_GROUP_NAME) + .withProperties(new VirtualMachineProperties().withMetadata(vmMetadata)) + .create(); + manager.virtualMachines().getByResourceGroup(RESOURCE_GROUP_NAME, "vm-shared1"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/nonresource/NonResourceTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/nonresource/NonResourceTests.java new file mode 100644 index 0000000000..be9de58af4 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/nonresource/NonResourceTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.nonresource; + +import azure.resourcemanager.nonresource.fluent.models.NonResourceInner; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +public final class NonResourceTests { + + private final NonResourceManager manager + = NonResourceManager.authenticate(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile()); + + @Test + public void testNonResourceGet() { + manager.nonResourceOperations().get("eastus", "hello"); + } + + @Test + public void testNonResourceCreate() { + NonResourceInner body = new NonResourceInner().withId("id").withName("hello").withType("nonResource"); + NonResourceInner result = manager.serviceClient().getNonResourceOperations().create("eastus", "hello", body); + Assertions.assertEquals("id", result.id()); + Assertions.assertEquals("hello", result.name()); + Assertions.assertEquals("nonResource", result.type()); + } + + @Disabled("It is mistakenly treated as a resource") + @Test + public void testNonResourcePut() { + manager.nonResourceOperations() + .define("hello") + .withExistingLocation("eastus") + .withName("hello") + .withType("nonResource") + .create(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/operationtemplates/OperationTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/operationtemplates/OperationTests.java new file mode 100644 index 0000000000..dbc75280f6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/operationtemplates/OperationTests.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.operationtemplates; + +import azure.resourcemanager.operationtemplates.fluent.models.WidgetInner; +import azure.resourcemanager.operationtemplates.models.ActionRequest; +import azure.resourcemanager.operationtemplates.models.ActionResult; +import azure.resourcemanager.operationtemplates.models.ActionType; +import azure.resourcemanager.operationtemplates.models.ChangeAllowanceRequest; +import azure.resourcemanager.operationtemplates.models.ChangeAllowanceResult; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityReason; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityRequest; +import azure.resourcemanager.operationtemplates.models.CheckNameAvailabilityResponse; +import azure.resourcemanager.operationtemplates.models.ExportRequest; +import azure.resourcemanager.operationtemplates.models.ExportResult; +import azure.resourcemanager.operationtemplates.models.Operation; +import azure.resourcemanager.operationtemplates.models.OperationDisplay; +import azure.resourcemanager.operationtemplates.models.Order; +import azure.resourcemanager.operationtemplates.models.OrderProperties; +import azure.resourcemanager.operationtemplates.models.Origin; +import azure.resourcemanager.operationtemplates.models.Product; +import azure.resourcemanager.operationtemplates.models.Widget; +import azure.resourcemanager.operationtemplates.models.WidgetProperties; +import com.azure.core.http.HttpPipeline; +import com.azure.core.management.Region; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Context; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Constructor; +import java.time.Duration; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; + +public class OperationTests { + private final OperationTemplatesManager manager = buildManager(); + + @Test + public void testCheckNameAvailability() { + CheckNameAvailabilityRequest request + = new CheckNameAvailabilityRequest().withName("checkName").withType("Microsoft.Web/site"); + + CheckNameAvailabilityResponse response = manager.checkNameAvailabilities().checkGlobal(request); + Assertions.assertFalse(response.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, response.reason()); + Assertions.assertEquals("Hostname 'checkName' already exists. Please select a different name.", + response.message()); + + response = manager.checkNameAvailabilities().checkLocal("westus", request); + Assertions.assertFalse(response.nameAvailable()); + Assertions.assertEquals(CheckNameAvailabilityReason.ALREADY_EXISTS, response.reason()); + Assertions.assertEquals("Hostname 'checkName' already exists. Please select a different name.", + response.message()); + } + + @Test + public void testListAvailableOperations() { + List operationList = manager.operations().list().stream().collect(Collectors.toList()); + Assertions.assertFalse(operationList.isEmpty()); + Assertions.assertEquals(1, operationList.size()); + Operation operation = operationList.get(0); + Assertions.assertNotNull(operation); + Assertions.assertEquals("Microsoft.Compute/virtualMachines/write", operation.name()); + Assertions.assertFalse(operation.isDataAction()); + OperationDisplay display = operation.display(); + Assertions.assertNotNull(display); + Assertions.assertEquals("Microsoft Compute", display.provider()); + Assertions.assertEquals("Virtual Machines", display.resource()); + Assertions.assertEquals("Create or Update Virtual Machine.", display.operation()); + Assertions.assertEquals("Add or modify virtual machines.", display.description()); + Assertions.assertEquals(Origin.USER_SYSTEM, operation.origin()); + Assertions.assertEquals(ActionType.INTERNAL, operation.actionType()); + } + + @Test + public void testLro() { + String orderName = "order1"; + String resourceGroup = "test-rg"; + Order order = manager.lroes() + .define(orderName) + .withRegion(Region.US_EAST) + .withExistingResourceGroup(resourceGroup) + .withProperties(new OrderProperties().withAmount(1).withProductId("product1")) + .create(); + + Assertions.assertEquals("Succeeded", order.properties().provisioningState()); + Assertions.assertNotNull(order.systemData()); + + ExportResult exportResult = order.export(new ExportRequest().withFormat("csv")); + Assertions.assertEquals("order1,product1,1", exportResult.content()); + + manager.lroes().deleteById(order.id()); + } + + @Test + public void testOptionalBody() { + String rgName = "test-rg"; + String resourceName = "widget1"; + Widget widget = manager.optionalBodies().getByResourceGroup(rgName, resourceName); + Assertions.assertEquals("A test widget", widget.properties().description()); + widget = manager.optionalBodies().patch(rgName, resourceName); + Assertions.assertEquals("A test widget", widget.properties().description()); + + ChangeAllowanceResult result = manager.optionalBodies().providerPost(); + Assertions.assertEquals(50, result.totalAllowed()); + Assertions.assertEquals("Changed to default allowance", result.status()); + result = manager.optionalBodies() + .providerPostWithResponse(new ChangeAllowanceRequest().withReason("Increased demand").withTotalAllowed(100), + Context.NONE) + .getValue(); + Assertions.assertEquals(100, result.totalAllowed()); + Assertions.assertEquals("Changed to requested allowance", result.status()); + + WidgetInner inner = widget.innerModel(); + inner.withProperties(new WidgetProperties().withName("updated-widget").withDescription("Updated description")); + widget = manager.optionalBodies().patchWithResponse(rgName, resourceName, inner, Context.NONE).getValue(); + Assertions.assertEquals("Updated description", widget.properties().description()); + Assertions.assertEquals("updated-widget", widget.properties().name()); + + ActionResult actionResult = manager.optionalBodies().post(rgName, resourceName); + Assertions.assertEquals("Action completed successfully", actionResult.result()); + + actionResult = manager.optionalBodies() + .postWithResponse(rgName, resourceName, + new ActionRequest().withActionType("perform").withParameters("test-parameters"), Context.NONE) + .getValue(); + Assertions.assertEquals("Action completed successfully with parameters", actionResult.result()); + } + + @Test + public void testLroPaging() { + String resourceGroup = "test-rg"; + String productName = "default"; + List productList + = manager.lroPagings().postPagingLro(resourceGroup, productName).stream().collect(Collectors.toList()); + Assertions.assertFalse(productList.isEmpty()); + Assertions.assertEquals(2, productList.size()); + + Product product1 = productList.get(0); + Assertions.assertNotNull(product1); + Assertions.assertEquals("product1", product1.name()); + Assertions.assertEquals("Succeeded", product1.properties().provisioningState()); + Assertions.assertEquals("product1", product1.properties().productId()); + + Product product2 = productList.get(1); + Assertions.assertNotNull(product2); + Assertions.assertEquals("product2", product2.name()); + Assertions.assertEquals("Succeeded", product2.properties().provisioningState()); + Assertions.assertEquals("product2", product2.properties().productId()); + } + + @Test + public void testExportArray() { + List exportResults = manager.lroes().exportArray(new ExportRequest().withFormat("csv")); + Assertions.assertFalse(exportResults.isEmpty()); + Assertions.assertEquals(2, exportResults.size()); + + ExportResult result1 = exportResults.get(0); + Assertions.assertNotNull(result1); + Assertions.assertEquals("order1,product1,1", result1.content()); + + ExportResult result2 = exportResults.get(1); + Assertions.assertNotNull(result2); + Assertions.assertEquals("order2,product2,2", result2.content()); + } + + // for LRO operations, we need to override default poll interval + private static OperationTemplatesManager buildManager() { + try { + Constructor constructor = OperationTemplatesManager.class + .getDeclaredConstructor(HttpPipeline.class, AzureProfile.class, Duration.class); + setAccessible(constructor); + return constructor.newInstance(ArmUtils.createTestHttpPipeline(), ArmUtils.getAzureProfile(), + Duration.ofMillis(1)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static void setAccessible(final AccessibleObject accessibleObject) { + // avoid bug in Java8 + Runnable runnable = () -> accessibleObject.setAccessible(true); + runnable.run(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/resources/ArmResourceTest.java b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/resources/ArmResourceTest.java new file mode 100644 index 0000000000..e72ab576bc --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/resourcemanager/resources/ArmResourceTest.java @@ -0,0 +1,708 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.resourcemanager.resources; + +import azure.resourcemanager.resources.fluent.models.SingletonTrackedResourceInner; +import azure.resourcemanager.resources.models.ExtensionsResource; +import azure.resourcemanager.resources.models.ExtensionsResourceProperties; +import azure.resourcemanager.resources.models.LocationResource; +import azure.resourcemanager.resources.models.LocationResourceProperties; +import azure.resourcemanager.resources.models.NestedProxyResource; +import azure.resourcemanager.resources.models.NestedProxyResourceProperties; +import azure.resourcemanager.resources.models.NotificationDetails; +import azure.resourcemanager.resources.models.ProvisioningState; +import azure.resourcemanager.resources.models.SingletonTrackedResource; +import azure.resourcemanager.resources.models.SingletonTrackedResourceProperties; +import azure.resourcemanager.resources.models.TopLevelTrackedResource; +import azure.resourcemanager.resources.models.TopLevelTrackedResourceProperties; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpPipelineNextSyncPolicy; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; +import reactor.core.publisher.Mono; + +public class ArmResourceTest { + private static final String TOP_LEVEL_TRACKED_RESOURCE_ID + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top"; + private static final String TOP_LEVEL_TRACKED_RESOURCE_NAME = "top"; + private static final String TOP_LEVEL_TRACKED_RESOURCE_TYPE + = "Azure.ResourceManager.Resources/topLevelTrackedResources"; + private static final String NESTED_PROXY_RESOURCE_ID + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources/nested"; + private static final String NESTED_PROXY_RESOURCE_NAME = "nested"; + private static final String NESTED_PROXY_RESOURCE_TYPE + = "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"; + private static final Region TOP_LEVEL_TRACKED_RESOURCE_REGION = Region.US_EAST; + private static final String RESOURCE_DESCRIPTION_VALID = "valid"; + private static final String RESOURCE_DESCRIPTION_VALID2 = "valid2"; + private static final ProvisioningState RESOURCE_PROVISIONING_STATE = ProvisioningState.SUCCEEDED; + private static final String RESOURCE_GROUP_NAME = "test-rg"; + private static final String NOTIFICATION_DETAILS_MESSAGE = "Resource action at top level."; + private static final String LOCATION_RESOURCE_NAME = "resource"; + private static final String LOCATION_RESOURCE_LOCATION = "eastus"; + private static final String LOCATION_RESOURCE_ID + = "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Azure.ResourceManager.Resources/locations/eastus/locationResources/resource"; + private static final String LOCATION_RESOURCE_TYPE = "Azure.ResourceManager.Resources/locationResources"; + private static final String EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + = "/subscriptions/00000000-0000-0000-0000-000000000000"; + private static final String EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg"; + private static final String EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top"; + private static final String EXTENSION_RESOURCE_TENANT_SCOPE_URI = ""; + private static final String EXTENSION_RESOURCE_NAME = "extension"; + private static final String EXTENSION_RESOURCE_TYPE = "Azure.ResourceManager.Resources/extensionsResources"; + private static final String EXTENSION_RESOURCE_BASE_ID + = "/providers/Azure.ResourceManager.Resources/extensionsResources/extension"; + private final ResourcesManager manager = ResourcesManager + .authenticate(ArmUtils.createTestHttpPipeline(List.of(NORMALIZE_URL_POLICY)), ArmUtils.getAzureProfile()); + private final static ExtensionsResourceProperties CREATE_PROPERTIES + = new ExtensionsResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID); + private final static ExtensionsResourceProperties UPDATE_PROPERTIES + = new ExtensionsResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID2); + private ExtensionsResource extensionResource; + private List extensionResources; + + private static final HttpPipelinePolicy NORMALIZE_URL_POLICY = new HttpPipelinePolicy() { + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + normalizeUrl(context.getHttpRequest()); + return next.process(); + } + + @Override + public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next) { + normalizeUrl(context.getHttpRequest()); + return next.processSync(); + } + + @Override + public HttpPipelinePosition getPipelinePosition() { + return HttpPipelinePosition.PER_CALL; + } + + private void normalizeUrl(HttpRequest httpRequest) { + String url = httpRequest.getUrl().toString(); + url = url.replace("//", "/").replace(":/", "://"); + httpRequest.setUrl(url); + } + }; + + @Test + public void testTenantExtensionResources() { + // Create + extensionResource = manager.extensionsResources() + .define(EXTENSION_RESOURCE_NAME) + .withExistingResourceUri(EXTENSION_RESOURCE_TENANT_SCOPE_URI) + .withProperties(CREATE_PROPERTIES) + .create(); + Assertions.assertEquals(EXTENSION_RESOURCE_BASE_ID, extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + ExtensionsResourceProperties properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // List + extensionResources = manager.extensionsResources() + .listByScope(EXTENSION_RESOURCE_TENANT_SCOPE_URI) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, extensionResources.size()); + extensionResource = extensionResources.get(0); + Assertions.assertEquals(EXTENSION_RESOURCE_BASE_ID, extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Get + extensionResource + = manager.extensionsResources().get(EXTENSION_RESOURCE_TENANT_SCOPE_URI, EXTENSION_RESOURCE_NAME); + Assertions.assertEquals(EXTENSION_RESOURCE_BASE_ID, extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Update + extensionResource.update().withProperties(UPDATE_PROPERTIES).apply(); + Assertions.assertEquals(EXTENSION_RESOURCE_BASE_ID, extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + ExtensionsResourceProperties updateProperties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, updateProperties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, updateProperties.provisioningState()); + // Delete + manager.extensionsResources() + .deleteByResourceGroup(EXTENSION_RESOURCE_TENANT_SCOPE_URI, EXTENSION_RESOURCE_NAME); + } + + @Test + public void testSubscriptionExtensionResources() { + // resource url format: /subscriptions/00000000-0000-0000-0000-000000000000 + // Create + extensionResource = manager.extensionsResources() + .define(EXTENSION_RESOURCE_NAME) + .withExistingResourceUri(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI) + .withProperties(CREATE_PROPERTIES) + .create(); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + ExtensionsResourceProperties properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // List + extensionResources = manager.extensionsResources() + .listByScope(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, extensionResources.size()); + extensionResource = extensionResources.get(0); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Get + extensionResource + = manager.extensionsResources().get(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI, EXTENSION_RESOURCE_NAME); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Update + extensionResource.update().withProperties(UPDATE_PROPERTIES).apply(); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Delete + manager.extensionsResources() + .deleteByResourceGroup(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI, EXTENSION_RESOURCE_NAME); + + // resource url format: subscriptions/00000000-0000-0000-0000-000000000000 + // Create + extensionResource = manager.extensionsResources() + .define(EXTENSION_RESOURCE_NAME) + .withExistingResourceUri(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI.substring(1)) + .withProperties(CREATE_PROPERTIES) + .create(); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // List + extensionResources = manager.extensionsResources() + .listByScope(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI.substring(1)) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, extensionResources.size()); + extensionResource = extensionResources.get(0); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Get + extensionResource = manager.extensionsResources() + .get(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI.substring(1), EXTENSION_RESOURCE_NAME); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Update + extensionResource.update().withProperties(UPDATE_PROPERTIES).apply(); + Assertions.assertEquals(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Delete + manager.extensionsResources() + .deleteByResourceGroup(EXTENSION_RESOURCE_SUBSCRIPTION_SCOPE_URI.substring(1), EXTENSION_RESOURCE_NAME); + } + + @Test + public void testResourceGroupExtensionResources() { + // resource uri format: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg + // Create + extensionResource = manager.extensionsResources() + .define(EXTENSION_RESOURCE_NAME) + .withExistingResourceUri(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI) + .withProperties(CREATE_PROPERTIES) + .create(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + ExtensionsResourceProperties properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // List + extensionResources = manager.extensionsResources() + .listByScope(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, extensionResources.size()); + extensionResource = extensionResources.get(0); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Get + extensionResource + = manager.extensionsResources().get(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI, EXTENSION_RESOURCE_NAME); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Update + extensionResource.update().withProperties(UPDATE_PROPERTIES).apply(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Delete + manager.extensionsResources() + .deleteByResourceGroup(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI, EXTENSION_RESOURCE_NAME); + + // resource uri format: subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg + // Create + extensionResource = manager.extensionsResources() + .define(EXTENSION_RESOURCE_NAME) + .withExistingResourceUri(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI.substring(1)) + .withProperties(CREATE_PROPERTIES) + .create(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // List + extensionResources = manager.extensionsResources() + .listByScope(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, extensionResources.size()); + extensionResource = extensionResources.get(0); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Get + extensionResource = manager.extensionsResources() + .get(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI.substring(1), EXTENSION_RESOURCE_NAME); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Update + extensionResource.update().withProperties(UPDATE_PROPERTIES).apply(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Delete + manager.extensionsResources() + .deleteByResourceGroup(EXTENSION_RESOURCE_RESOURCE_GROUP_SCOPE_URI.substring(1), EXTENSION_RESOURCE_NAME); + } + + @Test + public void testResourceExtensionResources() { + // resource uri format: + // /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top + // Create + extensionResource = manager.extensionsResources() + .define(EXTENSION_RESOURCE_NAME) + .withExistingResourceUri(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI) + .withProperties(CREATE_PROPERTIES) + .create(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + ExtensionsResourceProperties properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // List + extensionResources = manager.extensionsResources() + .listByScope(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, extensionResources.size()); + extensionResource = extensionResources.get(0); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Get + extensionResource + = manager.extensionsResources().get(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI, EXTENSION_RESOURCE_NAME); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Update + extensionResource.update().withProperties(UPDATE_PROPERTIES).apply(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Delete + manager.extensionsResources() + .deleteByResourceGroup(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI, EXTENSION_RESOURCE_NAME); + + // resource uri format: + // subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Azure.ResourceManager.Resources/topLevelTrackedResources/top + // Create + extensionResource = manager.extensionsResources() + .define(EXTENSION_RESOURCE_NAME) + .withExistingResourceUri(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI.substring(1)) + .withProperties(CREATE_PROPERTIES) + .create(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // List + extensionResources = manager.extensionsResources() + .listByScope(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI.substring(1)) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, extensionResources.size()); + extensionResource = extensionResources.get(0); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Get + extensionResource = manager.extensionsResources() + .get(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI.substring(1), EXTENSION_RESOURCE_NAME); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Update + extensionResource.update().withProperties(UPDATE_PROPERTIES).apply(); + Assertions.assertEquals(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI + EXTENSION_RESOURCE_BASE_ID, + extensionResource.id()); + Assertions.assertEquals(EXTENSION_RESOURCE_NAME, extensionResource.name()); + Assertions.assertEquals(EXTENSION_RESOURCE_TYPE, extensionResource.type()); + Assertions.assertNotNull(extensionResource.properties()); + properties = extensionResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + // Delete + manager.extensionsResources() + .deleteByResourceGroup(EXTENSION_RESOURCE_RESOURCE_SCOPE_URI.substring(1), EXTENSION_RESOURCE_NAME); + } + + @Test + public void testLocationResources() { + LocationResourceProperties properties + = new LocationResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID); + LocationResource locationResource = manager.locationResources() + .define(LOCATION_RESOURCE_NAME) + .withExistingLocation(LOCATION_RESOURCE_LOCATION) + .withProperties(properties) + .create(); + Assertions.assertEquals(LOCATION_RESOURCE_ID, locationResource.id()); + Assertions.assertEquals(LOCATION_RESOURCE_NAME, locationResource.name()); + Assertions.assertEquals(LOCATION_RESOURCE_TYPE, locationResource.type()); + Assertions.assertNotNull(locationResource.properties()); + properties = locationResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + + List locationResources = manager.locationResources() + .listByLocation(LOCATION_RESOURCE_LOCATION) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, locationResources.size()); + locationResource = locationResources.get(0); + Assertions.assertEquals(LOCATION_RESOURCE_ID, locationResource.id()); + Assertions.assertEquals(LOCATION_RESOURCE_NAME, locationResource.name()); + Assertions.assertEquals(LOCATION_RESOURCE_TYPE, locationResource.type()); + Assertions.assertNotNull(locationResource.properties()); + properties = locationResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + + locationResource = manager.locationResources().get(LOCATION_RESOURCE_LOCATION, LOCATION_RESOURCE_NAME); + Assertions.assertEquals(LOCATION_RESOURCE_ID, locationResource.id()); + Assertions.assertEquals(LOCATION_RESOURCE_NAME, locationResource.name()); + Assertions.assertEquals(LOCATION_RESOURCE_TYPE, locationResource.type()); + Assertions.assertNotNull(locationResource.properties()); + properties = locationResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + + properties = new LocationResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID2); + locationResource = locationResource.update().withProperties(properties).apply(); + Assertions.assertEquals(LOCATION_RESOURCE_ID, locationResource.id()); + Assertions.assertEquals(LOCATION_RESOURCE_NAME, locationResource.name()); + Assertions.assertEquals(LOCATION_RESOURCE_TYPE, locationResource.type()); + Assertions.assertNotNull(locationResource.properties()); + properties = locationResource.properties(); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, properties.description()); + Assertions.assertEquals(ProvisioningState.SUCCEEDED, properties.provisioningState()); + + manager.locationResources().deleteByResourceGroup(LOCATION_RESOURCE_LOCATION, LOCATION_RESOURCE_NAME); + } + + @Test + public void testTopLevelTrackedResource() { + // TopLevelTrackedResources.createOrReplace + TopLevelTrackedResource topLevelTrackedResource = manager.topLevels() + .define(TOP_LEVEL_TRACKED_RESOURCE_NAME) + .withRegion(Region.US_EAST) + .withExistingResourceGroup(RESOURCE_GROUP_NAME) + .withProperties(new TopLevelTrackedResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID)) + .create(); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_ID, topLevelTrackedResource.id()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_NAME, topLevelTrackedResource.name()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_TYPE, topLevelTrackedResource.type()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_REGION, topLevelTrackedResource.region()); + Assertions.assertNotNull(topLevelTrackedResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, topLevelTrackedResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, topLevelTrackedResource.properties().provisioningState()); + + manager.topLevels() + .actionSync(RESOURCE_GROUP_NAME, TOP_LEVEL_TRACKED_RESOURCE_NAME, + new NotificationDetails().withMessage(NOTIFICATION_DETAILS_MESSAGE).withUrgent(true)); + + topLevelTrackedResource + .actionSync(new NotificationDetails().withMessage(NOTIFICATION_DETAILS_MESSAGE).withUrgent(true)); + + // TopLevelTrackedResources.listByResourceGroup + List topLevelTrackedResourceList + = manager.topLevels().listByResourceGroup(RESOURCE_GROUP_NAME).stream().collect(Collectors.toList()); + Assertions.assertEquals(1, topLevelTrackedResourceList.size()); + topLevelTrackedResource = topLevelTrackedResourceList.get(0); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_ID, topLevelTrackedResource.id()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_NAME, topLevelTrackedResource.name()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_TYPE, topLevelTrackedResource.type()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_REGION, topLevelTrackedResource.region()); + Assertions.assertNotNull(topLevelTrackedResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, topLevelTrackedResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, topLevelTrackedResource.properties().provisioningState()); + + // TopLevelTrackedResources.listBySubscription + topLevelTrackedResourceList = manager.topLevels() + .list() + .stream() + .filter(resource -> TOP_LEVEL_TRACKED_RESOURCE_ID.equals(resource.id())) + .collect(Collectors.toList()); + Assertions.assertEquals(1, topLevelTrackedResourceList.size()); + topLevelTrackedResource = topLevelTrackedResourceList.get(0); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_ID, topLevelTrackedResource.id()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_NAME, topLevelTrackedResource.name()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_TYPE, topLevelTrackedResource.type()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_REGION, topLevelTrackedResource.region()); + Assertions.assertNotNull(topLevelTrackedResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, topLevelTrackedResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, topLevelTrackedResource.properties().provisioningState()); + + // TopLevelTrackedResources.get + topLevelTrackedResource + = manager.topLevels().getByResourceGroup(RESOURCE_GROUP_NAME, TOP_LEVEL_TRACKED_RESOURCE_NAME); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_ID, topLevelTrackedResource.id()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_NAME, topLevelTrackedResource.name()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_TYPE, topLevelTrackedResource.type()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_REGION, topLevelTrackedResource.region()); + Assertions.assertNotNull(topLevelTrackedResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, topLevelTrackedResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, topLevelTrackedResource.properties().provisioningState()); + + // TopLevelTrackedResources.update + topLevelTrackedResource.update() + .withProperties(new TopLevelTrackedResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID2)) + .apply(); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_ID, topLevelTrackedResource.id()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_NAME, topLevelTrackedResource.name()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_TYPE, topLevelTrackedResource.type()); + Assertions.assertEquals(TOP_LEVEL_TRACKED_RESOURCE_REGION, topLevelTrackedResource.region()); + Assertions.assertNotNull(topLevelTrackedResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, topLevelTrackedResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, topLevelTrackedResource.properties().provisioningState()); + + // TopLevelTrackedResources.delete + manager.topLevels().delete(RESOURCE_GROUP_NAME, TOP_LEVEL_TRACKED_RESOURCE_NAME, Context.NONE); + } + + @Test + public void testNestedProxyResource() { + // NestedProxyResources.createOrReplace + NestedProxyResource nestedProxyResource = manager.nesteds() + .define(NESTED_PROXY_RESOURCE_NAME) + .withExistingTopLevelTrackedResource(RESOURCE_GROUP_NAME, TOP_LEVEL_TRACKED_RESOURCE_NAME) + .withProperties(new NestedProxyResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID)) + .create(); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_ID, nestedProxyResource.id()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_NAME, nestedProxyResource.name()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_TYPE, nestedProxyResource.type()); + Assertions.assertNotNull(nestedProxyResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, nestedProxyResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, nestedProxyResource.properties().provisioningState()); + + // NestedProxyResources.listByTopLevelTrackedResource + List nestedProxyResourceList = manager.nesteds() + .listByTopLevelTrackedResource(RESOURCE_GROUP_NAME, TOP_LEVEL_TRACKED_RESOURCE_NAME) + .stream() + .collect(Collectors.toList()); + Assertions.assertEquals(1, nestedProxyResourceList.size()); + nestedProxyResource = nestedProxyResourceList.get(0); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_ID, nestedProxyResource.id()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_NAME, nestedProxyResource.name()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_TYPE, nestedProxyResource.type()); + Assertions.assertNotNull(nestedProxyResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, nestedProxyResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, nestedProxyResource.properties().provisioningState()); + + // NestedProxyResources.get + nestedProxyResource + = manager.nesteds().get(RESOURCE_GROUP_NAME, TOP_LEVEL_TRACKED_RESOURCE_NAME, NESTED_PROXY_RESOURCE_NAME); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_ID, nestedProxyResource.id()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_NAME, nestedProxyResource.name()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_TYPE, nestedProxyResource.type()); + Assertions.assertNotNull(nestedProxyResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, nestedProxyResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, nestedProxyResource.properties().provisioningState()); + + // NestedProxyResources.update + nestedProxyResource.update() + .withProperties(new NestedProxyResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID2)) + .apply(); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_ID, nestedProxyResource.id()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_NAME, nestedProxyResource.name()); + Assertions.assertEquals(NESTED_PROXY_RESOURCE_TYPE, nestedProxyResource.type()); + Assertions.assertNotNull(nestedProxyResource.properties()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, nestedProxyResource.properties().description()); + Assertions.assertEquals(RESOURCE_PROVISIONING_STATE, nestedProxyResource.properties().provisioningState()); + + // NestedProxyResources.delete + manager.nesteds().delete(RESOURCE_GROUP_NAME, TOP_LEVEL_TRACKED_RESOURCE_NAME, NESTED_PROXY_RESOURCE_NAME); + } + + @Test + public void testSingletonResource() { + final String resourceNameDefault = "default"; + + SingletonTrackedResource resource = manager.singletons() + .createOrUpdate(RESOURCE_GROUP_NAME, + new SingletonTrackedResourceInner().withLocation(TOP_LEVEL_TRACKED_RESOURCE_REGION.name()) + .withProperties( + new SingletonTrackedResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID))); + Assertions.assertEquals(resourceNameDefault, resource.name()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID, resource.properties().description()); + + resource = manager.singletons() + // TODO location should not be in PATCH + .update(RESOURCE_GROUP_NAME, new SingletonTrackedResourceInner().withLocation(Region.US_EAST2.name()) + .withProperties(new SingletonTrackedResourceProperties().withDescription(RESOURCE_DESCRIPTION_VALID2))); + Assertions.assertEquals(resourceNameDefault, resource.name()); + Assertions.assertEquals(RESOURCE_DESCRIPTION_VALID2, resource.properties().description()); + + resource = manager.singletons().getByResourceGroup(RESOURCE_GROUP_NAME); + Assertions.assertEquals(resourceNameDefault, resource.name()); + + resource = manager.singletons().listByResourceGroup(RESOURCE_GROUP_NAME).stream().findFirst().get(); + Assertions.assertEquals(resourceNameDefault, resource.name()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/specialheaders/conditionalrequest/ConditionalRequestTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/specialheaders/conditionalrequest/ConditionalRequestTests.java new file mode 100644 index 0000000000..0ce2c6656f --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/specialheaders/conditionalrequest/ConditionalRequestTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.specialheaders.conditionalrequest; + +import org.junit.jupiter.api.Test; + +public class ConditionalRequestTests { + + private final ConditionalRequestClient client = new ConditionalRequestClientBuilder().buildClient(); + + @Test + public void testConditionalRequestHeaders() { + client.postIfMatch("\"valid\""); + client.postIfNoneMatch("\"invalid\""); + client.postCustomIfMatch("\"valid\""); + client.postCustomIfNoneMatch("\"invalid\""); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdTests.java new file mode 100644 index 0000000000..f49e1e815e --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/specialheaders/xmsclientrequestid/XmsClientRequestIdTests.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.specialheaders.xmsclientrequestid; + +import org.junit.jupiter.api.Test; + +public class XmsClientRequestIdTests { + + private final XmsClientRequestIdClient client = new XmsClientRequestIdClientBuilder().buildClient(); + + @Test + public void testRequestId() { + client.get(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/azure/versioning/previewversion/PreviewVersionTests.java b/packages/typespec-java/emitter-tests/src/test/java/azure/versioning/previewversion/PreviewVersionTests.java new file mode 100644 index 0000000000..4e060c9d5f --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/azure/versioning/previewversion/PreviewVersionTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package azure.versioning.previewversion; + +import azure.versioning.previewversion.models.UpdateWidgetColorRequest; +import org.junit.jupiter.api.Test; + +public class PreviewVersionTests { + + private static final String widgetId = "widget-123"; + + @Test + public void testPreviewClient() { + PreviewVersionClient client = new PreviewVersionClientBuilder().buildClient(); + + client.getWidget(widgetId); + + client.updateWidgetColor(widgetId, new UpdateWidgetColorRequest().setColor("red")); + } + + @Test + public void testStableClient() { + PreviewVersionClient client + = new PreviewVersionClientBuilder().serviceVersion(PreviewVersionServiceVersion.V2024_06_01).buildClient(); + + client.listWidgets("test", null); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/clientnamespace/NamespaceTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/clientnamespace/NamespaceTests.java new file mode 100644 index 0000000000..af0be67cd1 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/clientnamespace/NamespaceTests.java @@ -0,0 +1,31 @@ +package client.clientnamespace; + +import client.clientnamespace.first.models.FirstClientResult; +import client.clientnamespace.second.ClientNamespaceSecondClient; +import client.clientnamespace.second.ClientNamespaceSecondClientBuilder; +import client.clientnamespace.second.models.SecondClientResult; +import client.clientnamespace.second.sub.models.SecondClientEnumType; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NamespaceTests { + + @Test + public void test() { + FirstClientResult firstClientResult = new ClientNamespaceFirstClientBuilder().buildClient().getFirst(); + + SecondClientResult secondClientResult = new ClientNamespaceSecondClientBuilder().buildClient().getSecond(); + + // assert Java package name is expected + Assertions.assertEquals("client.clientnamespace.ClientNamespaceFirstClient", + ClientNamespaceFirstClient.class.getName()); + Assertions.assertEquals("client.clientnamespace.second.ClientNamespaceSecondClient", + ClientNamespaceSecondClient.class.getName()); + Assertions.assertEquals("client.clientnamespace.first.models.FirstClientResult", + FirstClientResult.class.getName()); + Assertions.assertEquals("client.clientnamespace.second.models.SecondClientResult", + SecondClientResult.class.getName()); + Assertions.assertEquals("client.clientnamespace.second.sub.models.SecondClientEnumType", + SecondClientEnumType.class.getName()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/naming/NamingTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/naming/NamingTests.java new file mode 100644 index 0000000000..30f6239850 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/naming/NamingTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.naming; + +import client.naming.model.models.ClientModel; +import client.naming.model.models.JavaModel; +import client.naming.property.models.ClientNameAndJsonEncodedNameModel; +import client.naming.property.models.ClientNameModel; +import client.naming.property.models.LanguageClientNameModel; +import client.naming.unionenum.models.ClientExtensibleEnum; +import client.naming.unionenum.models.ExtensibleEnum; +import org.junit.jupiter.api.Test; + +public class NamingTests { + + private final NamingClient client = new NamingClientBuilder().buildClient(); + + private final PropertyClient propertyClient = new NamingClientBuilder().buildPropertyClient(); + + private final HeaderClient headerClient = new NamingClientBuilder().buildHeaderClient(); + + // client name should be "ClientModel", currently a bug in TCGC + private final ModelClient modelClient = new NamingClientBuilder().buildModelClient(); + + private final UnionEnumClient enumClient = new NamingClientBuilder().buildUnionEnumClient(); + + @Test + public void testNaming() { + // operation + client.clientName(); + + // parameter + client.parameter("true"); + + // property + propertyClient.client(new ClientNameModel(true)); + propertyClient.language(new LanguageClientNameModel(true)); + propertyClient.compatibleWithEncodedName(new ClientNameAndJsonEncodedNameModel(true)); + + // header + headerClient.request("true"); + headerClient.response(); // no class about response header at present + + // model + modelClient.client(new ClientModel(true)); + modelClient.language(new JavaModel(true)); + + // enum + enumClient.unionEnumName(ClientExtensibleEnum.ENUM_VALUE1); + enumClient.unionEnumMemberName(ExtensibleEnum.CLIENT_ENUM_VALUE1); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/naming/enumconflict/EnumConflictTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/naming/enumconflict/EnumConflictTests.java new file mode 100644 index 0000000000..02065da268 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/naming/enumconflict/EnumConflictTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.naming.enumconflict; + +import client.naming.enumconflict.firstnamespace.models.FirstModel; +import client.naming.enumconflict.firstnamespace.models.Status; +import client.naming.enumconflict.secondnamespace.models.SecondModel; +import client.naming.enumconflict.secondnamespace.models.SecondStatus; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class EnumConflictTests { + + private final FirstOperationsClient firstOperationsClient + = new EnumConflictClientBuilder().buildFirstOperationsClient(); + + private final SecondOperationsClient secondOperationsClient + = new EnumConflictClientBuilder().buildSecondOperationsClient(); + + @Test + public void testFirstNamespaceStatusEnum() { + // Test that we can use the Status enum from first namespace + FirstModel requestModel = new FirstModel(Status.ACTIVE, "test"); + FirstModel responseModel = firstOperationsClient.first(requestModel); + + Assertions.assertNotNull(responseModel); + Assertions.assertEquals(Status.ACTIVE, responseModel.getStatus()); + Assertions.assertEquals("test", responseModel.getName()); + } + + @Test + public void testSecondNamespaceStatusEnum() { + // Test that we can use the SecondStatus enum from second namespace + // Note: The conflict was resolved by renaming to SecondStatus + SecondModel requestModel = new SecondModel(SecondStatus.RUNNING, "test description"); + SecondModel responseModel = secondOperationsClient.second(requestModel); + + Assertions.assertNotNull(responseModel); + Assertions.assertEquals(SecondStatus.RUNNING, responseModel.getStatus()); + Assertions.assertEquals("test description", responseModel.getDescription()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/overload/MethodOverloadTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/overload/MethodOverloadTests.java new file mode 100644 index 0000000000..9e0a2fc39e --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/overload/MethodOverloadTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.overload; + +import client.overload.models.Resource; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * Test for overload operation in Java. + * + * This test validates method overloading capabilities where: + * - list() operation lists all resources + * - listByScope(String scope) operation lists resources filtered by scope + */ +public final class MethodOverloadTests { + + private final OverloadClient client = new OverloadClientBuilder().buildClient(); + + @Test + void testList() { + // Test the list operation that returns all resources + // Expected response: [{"id": "1", "name": "foo", "scope": "car"}, {"id": "2", "name": "bar", "scope": "bike"}] + List resources = client.list(); + + Assertions.assertNotNull(resources); + Assertions.assertEquals(2, resources.size()); + + // Verify first resource + Resource resource1 = resources.get(0); + Assertions.assertEquals("1", resource1.getId()); + Assertions.assertEquals("foo", resource1.getName()); + Assertions.assertEquals("car", resource1.getScope()); + + // Verify second resource + Resource resource2 = resources.get(1); + Assertions.assertEquals("2", resource2.getId()); + Assertions.assertEquals("bar", resource2.getName()); + Assertions.assertEquals("bike", resource2.getScope()); + } + + @Test + void testListByScope() { + // Test the listByScope operation that returns resources filtered by scope "car" + // Expected response: [{"id": "1", "name": "foo", "scope": "car"}] + String scope = "car"; + List resources = client.listByScope(scope); + + Assertions.assertNotNull(resources); + Assertions.assertEquals(1, resources.size()); + + // Verify the filtered resource + Resource resource = resources.get(0); + Assertions.assertEquals("1", resource.getId()); + Assertions.assertEquals("foo", resource.getName()); + Assertions.assertEquals("car", resource.getScope()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/structure/ClientOperationGroupTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/structure/ClientOperationGroupTests.java new file mode 100644 index 0000000000..d46a751fd5 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/structure/ClientOperationGroupTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.structure; + +import client.structure.anotherclientoperationgroup.subnamespace.SecondClientBuilder; +import client.structure.clientoperationgroup.FirstClientBuilder; +import client.structure.service.models.ClientType; +import org.junit.jupiter.api.Test; + +public class ClientOperationGroupTests { + + @Test + public void test() { + FirstClientBuilder clientBuilder1 + = new FirstClientBuilder().endpoint("http://localhost:3000").client(ClientType.CLIENT_OPERATION_GROUP); + SecondClientBuilder clientBuilder2 + = new SecondClientBuilder().endpoint("http://localhost:3000").client(ClientType.CLIENT_OPERATION_GROUP); + + clientBuilder1.buildClient().one(); + clientBuilder1.buildGroup3Client().two(); + clientBuilder1.buildGroup3Client().three(); + clientBuilder1.buildGroup4Client().four(); + + clientBuilder2.buildClient().five(); + clientBuilder2.buildGroup5Client().six(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/structure/DefaultClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/structure/DefaultClientTests.java new file mode 100644 index 0000000000..dceadbe3d0 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/structure/DefaultClientTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.structure; + +import client.structure.service.BarClient; +import client.structure.service.BazFooClient; +import client.structure.service.FooClient; +import client.structure.service.QuxBarClient; +import client.structure.service.QuxClient; +import client.structure.service.ServiceClientClient; +import client.structure.service.ServiceClientClientBuilder; +import client.structure.service.models.ClientType; +import org.junit.jupiter.api.Test; + +public class DefaultClientTests { + + private final ServiceClientClient client + = new ServiceClientClientBuilder().endpoint("http://localhost:3000").client(ClientType.DEFAULT).buildClient(); + + private final FooClient client2 = new ServiceClientClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.DEFAULT) + .buildFooClient(); + + private final BarClient client3 = new ServiceClientClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.DEFAULT) + .buildBarClient(); + + private final QuxClient client4 = new ServiceClientClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.DEFAULT) + .buildQuxClient(); + + private final QuxBarClient client5 = new ServiceClientClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.DEFAULT) + .buildQuxBarClient(); + + private final BazFooClient client6 = new ServiceClientClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.DEFAULT) + .buildBazFooClient(); + + @Test + public void testClient() { + client.one(); + client.two(); + client2.three(); + client2.four(); + client3.five(); + client3.six(); + client6.seven(); + client4.eight(); + client5.nine(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/structure/MultiClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/structure/MultiClientTests.java new file mode 100644 index 0000000000..f624e82e76 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/structure/MultiClientTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.structure; + +import client.structure.multiclient.ClientAClient; +import client.structure.multiclient.ClientAClientBuilder; +import client.structure.multiclient.ClientBClient; +import client.structure.multiclient.ClientBClientBuilder; +import client.structure.service.models.ClientType; +import org.junit.jupiter.api.Test; + +public class MultiClientTests { + + private final ClientAClient client1 + = new ClientAClientBuilder().endpoint("http://localhost:3000").client(ClientType.MULTI_CLIENT).buildClient(); + private final ClientBClient client2 + = new ClientBClientBuilder().endpoint("http://localhost:3000").client(ClientType.MULTI_CLIENT).buildClient(); + + @Test + public void testClient() { + client1.renamedOne(); + client1.renamedThree(); + client1.renamedFive(); + + client2.renamedTwo(); + client2.renamedFour(); + client2.renamedSix(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/structure/OperationGroupClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/structure/OperationGroupClientTests.java new file mode 100644 index 0000000000..924359aa96 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/structure/OperationGroupClientTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.structure; + +import client.structure.service.models.ClientType; +import client.structure.twooperationgroup.Group1Client; +import client.structure.twooperationgroup.Group2Client; +import client.structure.twooperationgroup.TwoOperationGroupClientBuilder; +import org.junit.jupiter.api.Test; + +public class OperationGroupClientTests { + + private final Group1Client client1 = new TwoOperationGroupClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.TWO_OPERATION_GROUP) + .buildGroup1Client(); + private final Group2Client client2 = new TwoOperationGroupClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.TWO_OPERATION_GROUP) + .buildGroup2Client(); + + @Test + public void testClient() { + client1.one(); + client1.three(); + client1.four(); + + client2.two(); + client2.five(); + client2.six(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/client/structure/RenameOperationTests.java b/packages/typespec-java/emitter-tests/src/test/java/client/structure/RenameOperationTests.java new file mode 100644 index 0000000000..fddefb74cf --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/client/structure/RenameOperationTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package client.structure; + +import client.structure.renamedoperation.GroupClient; +import client.structure.renamedoperation.RenamedOperationClient; +import client.structure.renamedoperation.RenamedOperationClientBuilder; +import client.structure.service.models.ClientType; +import org.junit.jupiter.api.Test; + +public class RenameOperationTests { + + private final RenamedOperationClient client = new RenamedOperationClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.RENAMED_OPERATION) + .buildClient(); + private final GroupClient groupClient = new RenamedOperationClientBuilder().endpoint("http://localhost:3000") + .client(ClientType.RENAMED_OPERATION) + .buildGroupClient(); + + @Test + public void testClient() { + client.renamedOne(); + client.renamedThree(); + client.renamedFive(); + + groupClient.renamedTwo(); + groupClient.renamedFour(); + groupClient.renamedSix(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/documentation/DocumentationTests.java b/packages/typespec-java/emitter-tests/src/test/java/documentation/DocumentationTests.java new file mode 100644 index 0000000000..58e856e202 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/documentation/DocumentationTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package documentation; + +import documentation.lists.models.BulletPointsEnum; +import documentation.lists.models.BulletPointsModel; +import org.junit.jupiter.api.Test; + +// Markdown in Javadoc is not supported till JDK23 +public class DocumentationTests { + + private final ListsClient listsClient = new DocumentationClientBuilder().buildListsClient(); + private final TextFormattingClient textFormattingClient + = new DocumentationClientBuilder().buildTextFormattingClient(); + + @Test + public void testBulletPointsOp() { + listsClient.bulletPointsOp(); + } + + @Test + public void testBulletPointsModel() { + listsClient.bulletPointsModel(new BulletPointsModel(BulletPointsEnum.SIMPLE)); + } + + @Test + public void testNumbered() { + listsClient.numbered(); + } + + @Test + public void testBoldText() { + textFormattingClient.boldText(); + } + + @Test + public void testItalicText() { + textFormattingClient.italicText(); + } + + @Test + public void testCombinedFormatting() { + textFormattingClient.combinedFormatting(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/encode/array/EncodeArraySerializationTests.java b/packages/typespec-java/emitter-tests/src/test/java/encode/array/EncodeArraySerializationTests.java new file mode 100644 index 0000000000..c6a58209e5 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/encode/array/EncodeArraySerializationTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package encode.array; + +import com.azure.core.util.BinaryData; +import encode.array.models.CommaDelimitedArrayProperty; +import java.util.LinkedList; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class EncodeArraySerializationTests { + + @Test + public void testNull() { + CommaDelimitedArrayProperty model = new CommaDelimitedArrayProperty(null); + Assertions.assertEquals("{}", BinaryData.fromObject(model).toString()); + + model = BinaryData.fromString("{}").toObject(CommaDelimitedArrayProperty.class); + Assertions.assertNull(model.getValue()); + } + + @Test + public void testEmptyStringOnWire() { + CommaDelimitedArrayProperty model = new CommaDelimitedArrayProperty(List.of()); + Assertions.assertEquals("{\"value\":\"\"}", BinaryData.fromObject(model).toString()); + + model = BinaryData.fromString("{\"value\":\"\"}").toObject(CommaDelimitedArrayProperty.class); + Assertions.assertEquals(0, model.getValue().size()); + } + + @Test + public void testEmptyElement() { + CommaDelimitedArrayProperty model = new CommaDelimitedArrayProperty(List.of("", "")); + Assertions.assertEquals("{\"value\":\",\"}", BinaryData.fromObject(model).toString()); + + model = BinaryData.fromString("{\"value\":\",\"}").toObject(CommaDelimitedArrayProperty.class); + Assertions.assertEquals(2, model.getValue().size()); + } + + @Test + public void testNullElement() { + List list = new LinkedList<>(); + list.add("data1"); + list.add(null); + list.add("data2"); + + CommaDelimitedArrayProperty model = new CommaDelimitedArrayProperty(list); + Assertions.assertEquals("{\"value\":\"data1,,data2\"}", BinaryData.fromObject(model).toString()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/encode/array/EncodeArrayTests.java b/packages/typespec-java/emitter-tests/src/test/java/encode/array/EncodeArrayTests.java new file mode 100644 index 0000000000..e0b36d1f05 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/encode/array/EncodeArrayTests.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package encode.array; + +import encode.array.models.Colors; +import encode.array.models.ColorsExtensibleEnum; +import encode.array.models.CommaDelimitedArrayProperty; +import encode.array.models.CommaDelimitedEnumArrayProperty; +import encode.array.models.CommaDelimitedExtensibleEnumArrayProperty; +import encode.array.models.NewlineDelimitedArrayProperty; +import encode.array.models.NewlineDelimitedEnumArrayProperty; +import encode.array.models.NewlineDelimitedExtensibleEnumArrayProperty; +import encode.array.models.PipeDelimitedArrayProperty; +import encode.array.models.PipeDelimitedEnumArrayProperty; +import encode.array.models.PipeDelimitedExtensibleEnumArrayProperty; +import encode.array.models.SpaceDelimitedArrayProperty; +import encode.array.models.SpaceDelimitedEnumArrayProperty; +import encode.array.models.SpaceDelimitedExtensibleEnumArrayProperty; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class EncodeArrayTests { + + private static final List COLORS = List.of("blue", "red", "green"); + private static final List ENUM_COLORS = List.of(Colors.BLUE, Colors.RED, Colors.GREEN); + private static final List EXTENSIBLE_ENUM_COLORS + = List.of(ColorsExtensibleEnum.BLUE, ColorsExtensibleEnum.RED, ColorsExtensibleEnum.GREEN); + + private final ArrayClient client = new ArrayClientBuilder().buildClient(); + + @Test + public void commaDelimitedProperty() { + CommaDelimitedArrayProperty response = client.commaDelimited(new CommaDelimitedArrayProperty(COLORS)); + Assertions.assertEquals(COLORS, response.getValue()); + } + + @Test + public void spaceDelimitedProperty() { + SpaceDelimitedArrayProperty response = client.spaceDelimited(new SpaceDelimitedArrayProperty(COLORS)); + Assertions.assertEquals(COLORS, response.getValue()); + } + + @Test + public void pipeDelimitedProperty() { + PipeDelimitedArrayProperty response = client.pipeDelimited(new PipeDelimitedArrayProperty(COLORS)); + Assertions.assertEquals(COLORS, response.getValue()); + } + + @Test + public void newlineDelimitedProperty() { + NewlineDelimitedArrayProperty response = client.newlineDelimited(new NewlineDelimitedArrayProperty(COLORS)); + Assertions.assertEquals(COLORS, response.getValue()); + } + + @Test + public void enumCommaDelimitedProperty() { + CommaDelimitedEnumArrayProperty response + = client.enumCommaDelimited(new CommaDelimitedEnumArrayProperty(ENUM_COLORS)); + Assertions.assertEquals(ENUM_COLORS, response.getValue()); + } + + @Test + public void enumSpaceDelimitedProperty() { + SpaceDelimitedEnumArrayProperty response + = client.enumSpaceDelimited(new SpaceDelimitedEnumArrayProperty(ENUM_COLORS)); + Assertions.assertEquals(ENUM_COLORS, response.getValue()); + } + + @Test + public void enumPipeDelimitedProperty() { + PipeDelimitedEnumArrayProperty response + = client.enumPipeDelimited(new PipeDelimitedEnumArrayProperty(ENUM_COLORS)); + Assertions.assertEquals(ENUM_COLORS, response.getValue()); + } + + @Test + public void enumNewlineDelimitedProperty() { + NewlineDelimitedEnumArrayProperty response + = client.enumNewlineDelimited(new NewlineDelimitedEnumArrayProperty(ENUM_COLORS)); + Assertions.assertEquals(ENUM_COLORS, response.getValue()); + } + + @Test + public void extensibleEnumCommaDelimitedProperty() { + CommaDelimitedExtensibleEnumArrayProperty response = client + .extensibleEnumCommaDelimited(new CommaDelimitedExtensibleEnumArrayProperty(EXTENSIBLE_ENUM_COLORS)); + Assertions.assertEquals(EXTENSIBLE_ENUM_COLORS, response.getValue()); + } + + @Test + public void extensibleEnumSpaceDelimitedProperty() { + SpaceDelimitedExtensibleEnumArrayProperty response = client + .extensibleEnumSpaceDelimited(new SpaceDelimitedExtensibleEnumArrayProperty(EXTENSIBLE_ENUM_COLORS)); + Assertions.assertEquals(EXTENSIBLE_ENUM_COLORS, response.getValue()); + } + + @Test + public void extensibleEnumPipeDelimitedProperty() { + PipeDelimitedExtensibleEnumArrayProperty response + = client.extensibleEnumPipeDelimited(new PipeDelimitedExtensibleEnumArrayProperty(EXTENSIBLE_ENUM_COLORS)); + Assertions.assertEquals(EXTENSIBLE_ENUM_COLORS, response.getValue()); + } + + @Test + public void extensibleEnumNewlineDelimitedProperty() { + NewlineDelimitedExtensibleEnumArrayProperty response = client + .extensibleEnumNewlineDelimited(new NewlineDelimitedExtensibleEnumArrayProperty(EXTENSIBLE_ENUM_COLORS)); + Assertions.assertEquals(EXTENSIBLE_ENUM_COLORS, response.getValue()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/encode/bytes/EncodeBytesTests.java b/packages/typespec-java/emitter-tests/src/test/java/encode/bytes/EncodeBytesTests.java new file mode 100644 index 0000000000..8c8248d0c2 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/encode/bytes/EncodeBytesTests.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package encode.bytes; + +import com.azure.core.util.BinaryData; +import encode.bytes.models.Base64BytesProperty; +import encode.bytes.models.Base64urlArrayBytesProperty; +import encode.bytes.models.Base64urlBytesProperty; +import encode.bytes.models.DefaultBytesProperty; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.FileUtils; + +public class EncodeBytesTests { + + private final QueryClient queryClient = new BytesClientBuilder().buildQueryClient(); + private final HeaderClient headerClient = new BytesClientBuilder().buildHeaderClient(); + private final PropertyClient propertyClient = new BytesClientBuilder().buildPropertyClient(); + private final RequestBodyClient requestClient = new BytesClientBuilder().buildRequestBodyClient(); + private final ResponseBodyClient responseClient = new BytesClientBuilder().buildResponseBodyClient(); + + private final static byte[] DATA = "test".getBytes(StandardCharsets.UTF_8); + private final static byte[] PNG = FileUtils.getPngBytes(); + + @Test + public void testQuery() { + queryClient.defaultMethod(DATA); + + queryClient.base64(DATA); + + queryClient.base64url(DATA); + + queryClient.base64urlArray(Arrays.asList(DATA, DATA)); + } + + @Test + public void testHeader() { + headerClient.defaultMethod(DATA); + + headerClient.base64(DATA); + + headerClient.base64url(DATA); + + headerClient.base64urlArray(Arrays.asList(DATA, DATA)); + } + + @Test + public void testProperty() { + propertyClient.defaultMethod(new DefaultBytesProperty(DATA)); + + propertyClient.base64(new Base64BytesProperty(DATA)); + + propertyClient.base64url(new Base64urlBytesProperty(DATA)); + + propertyClient.base64urlArray(new Base64urlArrayBytesProperty(Arrays.asList(DATA, DATA))); + } + + @Test + public void testRequestBody() { + requestClient.octetStream(BinaryData.fromBytes(PNG)); + requestClient.customContentType(BinaryData.fromBytes(PNG)); + requestClient.base64(DATA); + requestClient.base64url(DATA); + } + + @Test + public void testResponseBody() { + BinaryData binary = responseClient.octetStream(); + Assertions.assertArrayEquals(PNG, binary.toBytes()); + + binary = responseClient.customContentType(); + Assertions.assertArrayEquals(PNG, binary.toBytes()); + + byte[] bytes = responseClient.base64(); + Assertions.assertArrayEquals(DATA, bytes); + + bytes = responseClient.base64url(); + Assertions.assertArrayEquals(DATA, bytes); + } + + @Test + public void testBodyDefault() { + requestClient.defaultMethod(BinaryData.fromBytes(PNG)); + + BinaryData png = responseClient.defaultMethod(); + Assertions.assertArrayEquals(PNG, png.toBytes()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/encode/datetime/EncodeDateTimeTests.java b/packages/typespec-java/emitter-tests/src/test/java/encode/datetime/EncodeDateTimeTests.java new file mode 100644 index 0000000000..8df55acc01 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/encode/datetime/EncodeDateTimeTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package encode.datetime; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.Response; +import encode.datetime.models.DefaultDatetimeProperty; +import encode.datetime.models.Rfc3339DatetimeProperty; +import encode.datetime.models.Rfc7231DatetimeProperty; +import encode.datetime.models.UnixTimestampArrayDatetimeProperty; +import encode.datetime.models.UnixTimestampDatetimeProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class EncodeDateTimeTests { + + private final QueryClient queryClient = new DatetimeClientBuilder().buildQueryClient(); + private final HeaderClient headerClient = new DatetimeClientBuilder().buildHeaderClient(); + private final ResponseHeaderClient responseHeaderClient = new DatetimeClientBuilder().buildResponseHeaderClient(); + private final PropertyClient propertyClient = new DatetimeClientBuilder().buildPropertyClient(); + + private final static OffsetDateTime DATE0 = OffsetDateTime.of(2022, 8, 26, 14, 38, 0, 0, ZoneOffset.UTC); + private final static OffsetDateTime DATE1 = OffsetDateTime.of(2022, 8, 26, 18, 38, 0, 0, ZoneOffset.UTC); + private final static OffsetDateTime DATE2 + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(1686566864), ZoneOffset.UTC); + private final static OffsetDateTime DATE3 + = OffsetDateTime.ofInstant(Instant.ofEpochSecond(1686734256), ZoneOffset.UTC); + + @Test + public void testQuery() { + queryClient.defaultMethod(DATE1); + + queryClient.rfc3339(DATE1); + + queryClient.rfc7231(DATE0); + + queryClient.unixTimestamp(DATE2); + + queryClient.unixTimestampArray(Arrays.asList(DATE2, DATE3)); + } + + @Test + public void testRequestHeader() { + headerClient.defaultMethod(DATE0); + + headerClient.rfc3339(DATE1); + + headerClient.rfc7231(DATE0); + + headerClient.unixTimestamp(DATE2); + + headerClient.unixTimestampArray(Arrays.asList(DATE2, DATE3)); + } + + @Test + public void testResponseHeader() { + HttpHeaderName valueHeaderName = HttpHeaderName.fromString("value"); + + Response response = responseHeaderClient.defaultMethodWithResponse(null); + Assertions.assertNotNull(response.getHeaders().getValue(valueHeaderName)); + + response = responseHeaderClient.rfc3339WithResponse(null); + Assertions.assertNotNull(response.getHeaders().getValue(valueHeaderName)); + + response = responseHeaderClient.rfc7231WithResponse(null); + Assertions.assertNotNull(response.getHeaders().getValue(valueHeaderName)); + + response = responseHeaderClient.unixTimestampWithResponse(null); + Assertions.assertNotNull(response.getHeaders().getValue(valueHeaderName)); + } + + @Test + public void testProperty() { + propertyClient.defaultMethod(new DefaultDatetimeProperty(DATE1)); + + propertyClient.rfc3339(new Rfc3339DatetimeProperty(DATE1)); + + propertyClient.rfc7231(new Rfc7231DatetimeProperty(DATE0)); + + propertyClient.unixTimestamp(new UnixTimestampDatetimeProperty(DATE2)); + + List array = Arrays.asList(DATE2, DATE3); + UnixTimestampArrayDatetimeProperty ret + = propertyClient.unixTimestampArray(new UnixTimestampArrayDatetimeProperty(array)); + Assertions.assertEquals(array, ret.getValue()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/encode/duration/EncodeDurationTests.java b/packages/typespec-java/emitter-tests/src/test/java/encode/duration/EncodeDurationTests.java new file mode 100644 index 0000000000..9313e9e9b6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/encode/duration/EncodeDurationTests.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package encode.duration; + +import encode.duration.property.models.DefaultDurationProperty; +import encode.duration.property.models.Float64MillisecondsDurationProperty; +import encode.duration.property.models.Float64SecondsDurationProperty; +import encode.duration.property.models.FloatMillisecondsDurationArrayProperty; +import encode.duration.property.models.FloatMillisecondsDurationProperty; +import encode.duration.property.models.FloatMillisecondsLargerUnitDurationProperty; +import encode.duration.property.models.FloatSecondsDurationArrayProperty; +import encode.duration.property.models.FloatSecondsDurationProperty; +import encode.duration.property.models.FloatSecondsLargerUnitDurationProperty; +import encode.duration.property.models.ISO8601DurationProperty; +import encode.duration.property.models.Int32MillisecondsDurationProperty; +import encode.duration.property.models.Int32MillisecondsLargerUnitDurationProperty; +import encode.duration.property.models.Int32SecondsDurationProperty; +import encode.duration.property.models.Int32SecondsLargerUnitDurationProperty; +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class EncodeDurationTests { + + private final QueryClient queryClient = new DurationClientBuilder().buildQueryClient(); + private final HeaderClient headerClient = new DurationClientBuilder().buildHeaderClient(); + private final PropertyClient propertyClient = new DurationClientBuilder().buildPropertyClient(); + + private static final Duration DAY40 = Duration.ofDays(40); + private static final Duration SECOND35 = Duration.ofSeconds(35, 625_000_000); + private static final Duration SECOND36 = Duration.ofSeconds(36); + private static final Duration MILLIS35625 = Duration.ofMillis(35625); + private static final Duration MILLIS36000 = Duration.ofMillis(36000); + + @Test + public void testQuery() { + queryClient.defaultMethod(DAY40); + + queryClient.floatSeconds(SECOND35); + + queryClient.float64Seconds(SECOND35); + + queryClient.int32Seconds(SECOND36); + + queryClient.int32SecondsLargerUnit(Duration.ofMinutes(2)); + + queryClient.floatSecondsLargerUnit(Duration.ofMinutes(2).plusSeconds(30)); + + queryClient.iso8601(DAY40); + + queryClient.int32SecondsArray(Arrays.asList(SECOND36, Duration.ofSeconds(47))); + + queryClient.int32Milliseconds(MILLIS36000); + + queryClient.int32MillisecondsLargerUnit(Duration.ofMinutes(3)); + + queryClient.floatMilliseconds(MILLIS35625); + + queryClient.floatMillisecondsLargerUnit(Duration.ofMinutes(3).plusSeconds(30)); + + queryClient.float64Milliseconds(MILLIS35625); + + queryClient.int32MillisecondsArray(Arrays.asList(MILLIS36000, Duration.ofMillis(47000))); + } + + @Test + public void testHeader() { + headerClient.defaultMethod(DAY40); + + headerClient.floatSeconds(SECOND35); + + headerClient.float64Seconds(SECOND35); + + headerClient.int32Seconds(SECOND36); + + headerClient.int32SecondsLargerUnit(Duration.ofMinutes(2)); + + headerClient.floatSecondsLargerUnit(Duration.ofMinutes(2).plusSeconds(30)); + + headerClient.iso8601(DAY40); + + headerClient.iso8601Array(Arrays.asList(DAY40, Duration.ofDays(50))); + + headerClient.int32Milliseconds(MILLIS36000); + + headerClient.int32MillisecondsLargerUnit(Duration.ofMinutes(3)); + + headerClient.floatMilliseconds(MILLIS35625); + + headerClient.floatMillisecondsLargerUnit(Duration.ofMinutes(3).plusSeconds(30)); + + headerClient.float64Milliseconds(MILLIS35625); + + headerClient.int32MillisecondsArray(Arrays.asList(MILLIS36000, Duration.ofMillis(47000))); + } + + @Test + public void testProperty() { + Assertions.assertEquals(DAY40, propertyClient.defaultMethod(new DefaultDurationProperty(DAY40)).getValue()); + + Assertions.assertEquals(SECOND35, + propertyClient.floatSeconds(new FloatSecondsDurationProperty(SECOND35)).getValue()); + + Assertions.assertEquals(SECOND35, + propertyClient.float64Seconds(new Float64SecondsDurationProperty(SECOND35)).getValue()); + + Assertions.assertEquals(SECOND36, + propertyClient.int32Seconds(new Int32SecondsDurationProperty(SECOND36)).getValue()); + + Assertions.assertEquals(Duration.ofMinutes(2), + propertyClient.int32SecondsLargerUnit(new Int32SecondsLargerUnitDurationProperty(Duration.ofMinutes(2))) + .getValue()); + + Assertions.assertEquals(Duration.ofMinutes(2).plusSeconds(30), + propertyClient + .floatSecondsLargerUnit( + new FloatSecondsLargerUnitDurationProperty(Duration.ofMinutes(2).plusSeconds(30))) + .getValue()); + + propertyClient.iso8601(new ISO8601DurationProperty(DAY40)); + + List array = Arrays.asList(SECOND35, Duration.ofSeconds(46, 750_000_000)); + FloatSecondsDurationArrayProperty ret + = propertyClient.floatSecondsArray(new FloatSecondsDurationArrayProperty(array)); + Assertions.assertEquals(array, ret.getValue()); + + Assertions.assertEquals(MILLIS36000, + propertyClient.int32Milliseconds(new Int32MillisecondsDurationProperty(MILLIS36000)).getValue()); + + Assertions.assertEquals(MILLIS35625, + propertyClient.floatMilliseconds(new FloatMillisecondsDurationProperty(MILLIS35625)).getValue()); + + Assertions.assertEquals(MILLIS35625, + propertyClient.float64Milliseconds(new Float64MillisecondsDurationProperty(MILLIS35625)).getValue()); + + Assertions.assertEquals(Duration.ofMinutes(3), + propertyClient + .int32MillisecondsLargerUnit(new Int32MillisecondsLargerUnitDurationProperty(Duration.ofMinutes(3))) + .getValue()); + + Assertions.assertEquals(Duration.ofMinutes(3).plusSeconds(30), + propertyClient + .floatMillisecondsLargerUnit( + new FloatMillisecondsLargerUnitDurationProperty(Duration.ofMinutes(3).plusSeconds(30))) + .getValue()); + + List millisArray = Arrays.asList(Duration.ofMillis(35625), Duration.ofMillis(46750)); + FloatMillisecondsDurationArrayProperty millisArrayRet + = propertyClient.floatMillisecondsArray(new FloatMillisecondsDurationArrayProperty(millisArray)); + Assertions.assertEquals(millisArray, millisArrayRet.getValue()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/encode/numeric/StringEncodeTests.java b/packages/typespec-java/emitter-tests/src/test/java/encode/numeric/StringEncodeTests.java new file mode 100644 index 0000000000..4e5bfa9cb0 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/encode/numeric/StringEncodeTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package encode.numeric; + +import encode.numeric.property.models.SafeintAsStringProperty; +import encode.numeric.property.models.Uint32AsStringProperty; +import encode.numeric.property.models.Uint8AsStringProperty; +import org.junit.jupiter.api.Test; + +public class StringEncodeTests { + + private final NumericClient client = new NumericClientBuilder().buildClient(); + + @Test + public void testIntEncodedAsString() { + client.safeintAsString(new SafeintAsStringProperty(10000000000L)); + + client.uint32AsStringOptional(new Uint32AsStringProperty().setValue(1)); + + client.uint8AsString(new Uint8AsStringProperty(255)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/org/utils/ArmUtils.java b/packages/typespec-java/emitter-tests/src/test/java/org/utils/ArmUtils.java new file mode 100644 index 0000000000..7102a90d36 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/org/utils/ArmUtils.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package org.utils; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public final class ArmUtils { + + private final static AzureProfile AZURE_PROFILE + = new AzureProfile("00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000", + new AzureEnvironment(Map.of("resourceManagerEndpointUrl", "http://localhost:3000"))); + + private ArmUtils() { + } + + public static HttpPipeline createTestHttpPipeline() { + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.add(new RetryPolicy("Retry-After", ChronoUnit.SECONDS)); + policies.add(new AddDatePolicy()); + // no ArmChallengeAuthenticationPolicy + policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); + return new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])).build(); + } + + public static HttpPipeline createTestHttpPipeline(List pipelinePolicies) { + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .forEach(policies::add); + policies.add(new RetryPolicy("Retry-After", ChronoUnit.SECONDS)); + policies.add(new AddDatePolicy()); + pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .forEach(policies::add); + // no ArmChallengeAuthenticationPolicy + policies.add(new HttpLoggingPolicy(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS))); + return new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])).build(); + } + + public static AzureProfile getAzureProfile() { + return AZURE_PROFILE; + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/org/utils/BinaryDataUtils.java b/packages/typespec-java/emitter-tests/src/test/java/org/utils/BinaryDataUtils.java new file mode 100644 index 0000000000..1652fd1ae0 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/org/utils/BinaryDataUtils.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package org.utils; + +import com.azure.core.util.BinaryData; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public class BinaryDataUtils { + + public static void assertMapEquals(Map left, Map right) { + Assertions.assertEquals(left.size(), right.size()); + for (String key : left.keySet()) { + BinaryData leftValue = left.get(key); + BinaryData rightValue = right.get(key); + Assertions.assertArrayEquals(leftValue.toBytes(), rightValue.toBytes()); + } + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/org/utils/FileUtils.java b/packages/typespec-java/emitter-tests/src/test/java/org/utils/FileUtils.java new file mode 100644 index 0000000000..f002da96f9 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/org/utils/FileUtils.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package org.utils; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +public class FileUtils { + + private FileUtils() { + } + + public static Path getJpgFile() { + return Paths.get("node_modules/@typespec/http-specs/assets/image.jpg"); + } + + public static Path getPngFile() { + return Paths.get("node_modules/@typespec/http-specs/assets/image.png"); + } + + public static byte[] getJpgBytes() { + try { + return Files.readAllBytes(getJpgFile()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public static byte[] getPngBytes() { + try { + return Files.readAllBytes(getPngFile()); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/parameters/basic/BasicClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/parameters/basic/BasicClientTests.java new file mode 100644 index 0000000000..bf00ade861 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/parameters/basic/BasicClientTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package parameters.basic; + +import org.junit.jupiter.api.Test; +import parameters.basic.explicitbody.models.User; + +public class BasicClientTests { + private final ExplicitBodyClient explicitBodyClient = new BasicClientBuilder().buildExplicitBodyClient(); + private final ImplicitBodyClient implicitBodyClient = new BasicClientBuilder().buildImplicitBodyClient(); + + @Test + public void testBodyClient() { + explicitBodyClient.simple(new User("foo")); + implicitBodyClient.simple("foo"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/parameters/bodyoptionality/BodyTests.java b/packages/typespec-java/emitter-tests/src/test/java/parameters/bodyoptionality/BodyTests.java new file mode 100644 index 0000000000..c5e545ca58 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/parameters/bodyoptionality/BodyTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package parameters.bodyoptionality; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpPipelinePolicy; +import org.junit.jupiter.api.AssertionFailureBuilder; +import org.junit.jupiter.api.Test; +import parameters.bodyoptionality.models.BodyModel; +import reactor.core.publisher.Mono; + +public class BodyTests { + + private final ContentTypeValidationPolicy validationPolicy = new ContentTypeValidationPolicy(); + private final BodyOptionalityClient client = new BodyOptionalityClientBuilder().buildClient(); + private final OptionalExplicitClient optionalClient = new BodyOptionalityClientBuilder().addPolicy(validationPolicy) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .buildOptionalExplicitClient(); + + private final static class ContentTypeValidationPolicy implements HttpPipelinePolicy { + private boolean contentTypeHeaderExists; + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy nextPolicy) { + contentTypeHeaderExists = context.getHttpRequest().getHeaders().get(HttpHeaderName.CONTENT_TYPE) != null; + return nextPolicy.process(); + } + + private void validateContentTypeHeader(boolean exists) { + if (exists != contentTypeHeaderExists) { + AssertionFailureBuilder.assertionFailure() + .message("content-type header validation failed") + .expected(exists) + .actual(contentTypeHeaderExists) + .buildAndThrow(); + } + } + } + + @Test + public void testBodyOptionality() { + client.requiredExplicit(new BodyModel("foo")); + + client.requiredImplicit("foo"); + + optionalClient.set(new BodyModel("foo")); + validationPolicy.validateContentTypeHeader(true); + + // verify that content-type is not set, when there is no body parameter + optionalClient.omit(); + validationPolicy.validateContentTypeHeader(false); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/parameters/bodyroot/BodyRootTests.java b/packages/typespec-java/emitter-tests/src/test/java/parameters/bodyroot/BodyRootTests.java new file mode 100644 index 0000000000..95087f9a00 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/parameters/bodyroot/BodyRootTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package parameters.bodyroot; + +import org.junit.jupiter.api.Test; +import parameters.bodyroot.models.BodyRootModel; + +public class BodyRootTests { + + private final BodyRootClient client = new BodyRootClientBuilder().buildClient(); + + @Test + public void testNested() { + client.nested(new BodyRootModel().setCategory("widget").setLinkType("hard").setWasSuccessful(true)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/parameters/collectionformat/CollectionFormatClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/parameters/collectionformat/CollectionFormatClientTest.java new file mode 100644 index 0000000000..3a09cab414 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/parameters/collectionformat/CollectionFormatClientTest.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package parameters.collectionformat; + +import java.util.Arrays; +import org.junit.jupiter.api.Test; + +class CollectionFormatClientTest { + + private final QueryClient client = new CollectionFormatClientBuilder().buildQueryClient(); + private final HeaderClient headerClient = new CollectionFormatClientBuilder().buildHeaderClient(); + + @Test + void testMulti() { + client.multi(Arrays.asList("blue", "red", "green")); + } + + @Test + void testCsv() { + client.csv(Arrays.asList("blue", "red", "green")); + } + + @Test + void testSsv() { + client.ssv(Arrays.asList("blue", "red", "green")); + } + + @Test + void testPipe() { + client.pipes(Arrays.asList("blue", "red", "green")); + } + + @Test + void testCsvHeader() { + headerClient.csv(Arrays.asList("blue", "red", "green")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/parameters/path/PathTests.java b/packages/typespec-java/emitter-tests/src/test/java/parameters/path/PathTests.java new file mode 100644 index 0000000000..287f4e0c40 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/parameters/path/PathTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package parameters.path; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public final class PathTests { + + private final PathClient client = new PathClientBuilder().buildClient(); + + @Test + public void testNormal() { + client.normal("foo"); + } + + @Disabled("optional path parameter is not supported") + @Test + public void testOptional() { + client.optional(); + client.optional("foo"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/parameters/query/QueryTests.java b/packages/typespec-java/emitter-tests/src/test/java/parameters/query/QueryTests.java new file mode 100644 index 0000000000..8f51293887 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/parameters/query/QueryTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package parameters.query; + +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +public class QueryTests { + + private final ConstantClient constantClient = new QueryClientBuilder().buildConstantClient(); + private final SpecialCharClient specialCharClient = new QueryClientBuilder().buildSpecialCharClient(); + + @Test + public void testConstant() { + constantClient.post(); + } + + @Test + @Disabled("Blocked until @typespec/http-specs publishes the dollar-sign route fix") + public void testDollarSign() { + specialCharClient.dollarSign("status eq 'active'"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/parameters/spread/SpreadTests.java b/packages/typespec-java/emitter-tests/src/test/java/parameters/spread/SpreadTests.java new file mode 100644 index 0000000000..8d763f8774 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/parameters/spread/SpreadTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package parameters.spread; + +import java.util.List; +import org.junit.jupiter.api.Test; +import parameters.spread.model.models.BodyParameter; + +public class SpreadTests { + + private final AliasClient aliasClient = new SpreadClientBuilder().buildAliasClient(); + private final ModelClient modelClient = new SpreadClientBuilder().buildModelClient(); + + @Test + public void testSpread() { + + aliasClient.spreadAsRequestBody("foo"); + + aliasClient.spreadAsRequestParameter("1", "bar", "foo"); + + aliasClient.spreadWithMultipleParameters("1", "bar", "foo", List.of(1, 2), 1, List.of("foo", "bar")); + + aliasClient.spreadParameterWithInnerAlias("1", "bar", "foo", 1); + + aliasClient.spreadParameterWithInnerModel("1", "bar", "foo"); + } + + @Test + public void testModel() { + + modelClient.spreadAsRequestBody("foo"); + modelClient.spreadCompositeRequestOnlyWithBody(new BodyParameter("foo")); + modelClient.spreadCompositeRequestWithoutBody("foo", "bar"); + modelClient.spreadCompositeRequest("foo", "bar", new BodyParameter("foo")); + modelClient.spreadCompositeRequestMix("foo", "bar", "foo"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/payload/contentnegotiation/SharedRouteTests.java b/packages/typespec-java/emitter-tests/src/test/java/payload/contentnegotiation/SharedRouteTests.java new file mode 100644 index 0000000000..9144458398 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/payload/contentnegotiation/SharedRouteTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package payload.contentnegotiation; + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.FileUtils; +import payload.contentnegotiation.differentbody.models.PngImageAsJson; + +public class SharedRouteTests { + + private final SameBodyClient client1 = new ContentNegotiationClientBuilder().buildSameBodyClient(); + private final DifferentBodyClient client2 = new ContentNegotiationClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .buildDifferentBodyClient(); + + @Test + public void testContentNegotiation() { + byte[] jpgBytes = FileUtils.getJpgBytes(); + byte[] pngBytes = FileUtils.getPngBytes(); + + BinaryData jpeg = client1.getAvatarAsJpeg(); + Assertions.assertNotNull(jpeg); + Assertions.assertArrayEquals(jpgBytes, jpeg.toBytes()); + + BinaryData png = client1.getAvatarAsPng(); + Assertions.assertNotNull(png); + Assertions.assertArrayEquals(pngBytes, png.toBytes()); + + PngImageAsJson pngJson = client2.getAvatarAsJson(); + Assertions.assertNotNull(pngJson.getContent()); + Assertions.assertArrayEquals(pngBytes, pngJson.getContent()); + + png = client2.getAvatarAsPng(); + Assertions.assertNotNull(png); + Assertions.assertArrayEquals(pngBytes, png.toBytes()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/payload/head/HeadTests.java b/packages/typespec-java/emitter-tests/src/test/java/payload/head/HeadTests.java new file mode 100644 index 0000000000..67fc19bb7a --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/payload/head/HeadTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package payload.head; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.Response; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class HeadTests { + + private final HeadClient client = new HeadClientBuilder().buildClient(); + + @Test + public void testResponseHeaders() { + Response response = client.contentTypeHeaderInResponseWithResponse(new RequestOptions()); + Assertions.assertEquals("text/plain; charset=utf-8", + response.getHeaders().getValue(HttpHeaderName.CONTENT_TYPE)); + Assertions.assertEquals("hello", response.getHeaders().getValue("x-ms-meta")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/payload/jsonmergepatch/JsonMergePatchClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/payload/jsonmergepatch/JsonMergePatchClientTest.java new file mode 100644 index 0000000000..8f40572b39 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/payload/jsonmergepatch/JsonMergePatchClientTest.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package payload.jsonmergepatch; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Test; +import payload.jsonmergepatch.models.InnerModel; +import payload.jsonmergepatch.models.Resource; +import payload.jsonmergepatch.models.ResourcePatch; + +public class JsonMergePatchClientTest { + + private final JsonMergePatchClient client = new JsonMergePatchClientBuilder().buildClient(); + + @Test + public void createAndUpdateResource() { + // create resource + Resource resource = buildResource(); + client.createResource(resource); + // update resource + ResourcePatch resourcePatch = buildResourcePatchWithNullProperties(); + client.updateResource(resourcePatch); + } + + @Test + public void updateOptionalResource() { + ResourcePatch resourcePatch = buildResourcePatchWithNullProperties(); + client.updateOptionalResource(resourcePatch); + } + + private static Resource buildResource() { + InnerModel innerModel = new InnerModel(); + innerModel.setName("InnerMadge"); + innerModel.setDescription("innerDesc"); + Map map = new HashMap<>(); + map.put("key", innerModel); + List array = Arrays.asList(innerModel); + Resource resource = new Resource("Madge"); + resource.setArray(array); + resource.setMap(map); + resource.setDescription("desc"); + resource.setIntValue(1); + resource.setFloatValue(1.25); + resource.setInnerModel(innerModel); + resource.setIntArray(Arrays.asList(1, 2, 3)); + return resource; + } + + private static ResourcePatch buildResourcePatchWithNullProperties() { + ResourcePatch resourcePatch = new ResourcePatch(); + resourcePatch.setDescription(null); + resourcePatch.setMap(new HashMap<>()); + resourcePatch.getMap().put("key", new InnerModel().setDescription(null)); + resourcePatch.getMap().put("key2", null); + resourcePatch.setArray(null); + resourcePatch.setInnerModel(null); + resourcePatch.setIntValue(null); + resourcePatch.setFloatValue(null); + resourcePatch.setInnerModel(null); + resourcePatch.setIntArray(null); + return resourcePatch; + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/payload/mediatype/MediaTypeTests.java b/packages/typespec-java/emitter-tests/src/test/java/payload/mediatype/MediaTypeTests.java new file mode 100644 index 0000000000..34667ede7c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/payload/mediatype/MediaTypeTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package payload.mediatype; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class MediaTypeTests { + + private final MediaTypeClient client = new MediaTypeClientBuilder().buildClient(); + + @Test + public void test() { + client.sendAsJson(client.getAsJson()); + + String text = client.getAsText(); + Assertions.assertEquals("{cat}", text); + client.sendAsText(text); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/payload/multipart/MultipartTests.java b/packages/typespec-java/emitter-tests/src/test/java/payload/multipart/MultipartTests.java new file mode 100644 index 0000000000..cec42f0e5e --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/payload/multipart/MultipartTests.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package payload.multipart; + +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.util.BinaryData; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.FileUtils; +import payload.multipart.formdata.file.models.FileWithRequiredFilename; +import payload.multipart.formdata.file.models.UploadFileArrayRequest; +import payload.multipart.formdata.file.models.UploadFileRequiredFilenameRequest; +import payload.multipart.formdata.file.models.UploadFileSpecificContentTypeRequest; +import payload.multipart.formdata.httpparts.nonstring.models.FloatRequest; +import payload.multipart.formdata.models.AnonymousModelRequest; +import payload.multipart.models.Address; +import payload.multipart.models.BinaryArrayPartsRequest; +import payload.multipart.models.ComplexHttpPartsModelRequest; +import payload.multipart.models.ComplexPartsRequest; +import payload.multipart.models.FileDetails; +import payload.multipart.models.FileOptionalContentType; +import payload.multipart.models.FileRequiredMetaData; +import payload.multipart.models.FileSpecificContentType; +import payload.multipart.models.FileWithHttpPartOptionalContentTypeRequest; +import payload.multipart.models.FileWithHttpPartRequiredContentTypeRequest; +import payload.multipart.models.FileWithHttpPartSpecificContentTypeRequest; +import payload.multipart.models.FilesFileDetails; +import payload.multipart.models.ImageFileDetails; +import payload.multipart.models.JsonPartRequest; +import payload.multipart.models.MultiBinaryPartsRequest; +import payload.multipart.models.MultiPartOptionalRequest; +import payload.multipart.models.MultiPartRequest; +import payload.multipart.models.MultiPartRequestWithWireName; +import payload.multipart.models.PictureFileDetails; +import payload.multipart.models.PicturesFileDetails; +import payload.multipart.models.ProfileImageFileDetails; +import reactor.core.publisher.Mono; + +public class MultipartTests { + + private final MultipartFilenameValidationPolicy validationPolicy = new MultipartFilenameValidationPolicy(); + + private final FormDataClient client + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataClient(); + private final FormDataAsyncClient asyncClient + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataAsyncClient(); + + private final FormDataHttpPartsContentTypeClient httpPartContentTypeClient + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataHttpPartsContentTypeClient(); + + private static final Path FILE = FileUtils.getJpgFile(); + + private static final Path PNG_FILE = FileUtils.getPngFile(); + + private static final String FILENAME = "image"; + private static final String FILE_CONTENT_TYPE = "application/octet-stream"; + + private final static class KpmAlgorithm { + private static int indexOf(byte[] data, int start, int stop, byte[] pattern) { + if (data == null || pattern == null) + return -1; + + int[] failure = computeFailure(pattern); + + int j = 0; + + for (int i = start; i < stop; i++) { + while (j > 0 && (pattern[j] != '*' && pattern[j] != data[i])) { + j = failure[j - 1]; + } + if (pattern[j] == '*' || pattern[j] == data[i]) { + j++; + } + if (j == pattern.length) { + return i - pattern.length + 1; + } + } + return -1; + } + + private static int[] computeFailure(byte[] pattern) { + int[] failure = new int[pattern.length]; + + int j = 0; + for (int i = 1; i < pattern.length; i++) { + while (j > 0 && pattern[j] != pattern[i]) { + j = failure[j - 1]; + } + if (pattern[j] == pattern[i]) { + j++; + } + failure[i] = j; + } + + return failure; + } + } + + private final static class MultipartFilenameValidationPolicy implements HttpPipelinePolicy { + private final List filenames = new ArrayList<>(); + private final List contentTypes = new ArrayList<>(); + + private final static Pattern FILENAME_PATTERN = Pattern.compile("filename=\"(.*?)\""); + private final static Pattern CONTENT_TYPE_PATTERN = Pattern.compile("Content-Type:\\s*(.*)"); + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy nextPolicy) { + filenames.clear(); + byte[] body = context.getHttpRequest().getBodyAsBinaryData().toBytes(); + int start = 0; + int stop = body.length; + byte[] pattern = "Content-Disposition:".getBytes(StandardCharsets.UTF_8); + + int index; + while ((index = KpmAlgorithm.indexOf(body, start, stop, pattern)) >= 0) { + int posNewLine; + for (posNewLine = index; posNewLine < stop; ++posNewLine) { + if (body[posNewLine] == 10 || body[posNewLine] == 13) { + // newline + String line = new String(body, index, posNewLine - index, StandardCharsets.UTF_8); + Matcher matcher = FILENAME_PATTERN.matcher(line); + if (matcher.find()) { + filenames.add(matcher.group(1)); + } + break; + } + } + start = posNewLine + 1; + } + + start = 0; + byte[] contentTypePattern = "Content-Type:".getBytes(StandardCharsets.UTF_8); + + while ((index = KpmAlgorithm.indexOf(body, start, stop, contentTypePattern)) >= 0) { + int posNewLine; + for (posNewLine = index; posNewLine < stop; ++posNewLine) { + if (body[posNewLine] == 10 || body[posNewLine] == 13) { + // newline + String line = new String(body, index, posNewLine - index, StandardCharsets.UTF_8); + Matcher matcher = CONTENT_TYPE_PATTERN.matcher(line); + if (matcher.find()) { + contentTypes.add(matcher.group(1)); + } + break; + } + } + start = posNewLine + 1; + } + + // reset the body to compensate here consuming all the data + context.getHttpRequest().setBody(body); + return nextPolicy.process(); + } + + private void validateFilenames(String... filenames) { + Assertions.assertEquals(Arrays.asList(filenames), this.filenames); + } + + private void validateContentTypes(String... contentTypes) { + Assertions.assertEquals(Arrays.asList(contentTypes), this.contentTypes); + } + } + + @Test + public void testBasic() { + MultiPartRequest request = new MultiPartRequest("123", + new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg")); + + client.basic(request); + asyncClient.basic(request).block(); + } + + @Test + public void testWithWireName() { + MultiPartRequestWithWireName request = new MultiPartRequestWithWireName("123", + new ImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg")); + + client.withWireName(request); + asyncClient.withWireName(request).block(); + } + + @Test + public void testOptionalParts() { + // Test with only id + MultiPartOptionalRequest requestWithIdOnly = new MultiPartOptionalRequest().setId("123"); + client.optionalParts(requestWithIdOnly); + + // Test with only profileImage + MultiPartOptionalRequest requestWithImageOnly = new MultiPartOptionalRequest() + .setProfileImage(new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg")); + asyncClient.optionalParts(requestWithImageOnly).block(); + + // Test with both id and profileImage + MultiPartOptionalRequest requestWithBoth = new MultiPartOptionalRequest().setId("123") + .setProfileImage(new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg")); + client.optionalParts(requestWithBoth); + } + + @Test + public void testJson() { + client.jsonPart(new JsonPartRequest(new Address("X"), + new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg"))); + } + + // JSON array removed from cadl-ranch +// @Test +// public void testJsonArray() { +// client.jsonArrayParts(new JsonArrayPartsRequest( +// new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg"), +// Arrays.asList(new Address("Y"), new Address("Z")))); +// } + + @Test + public void testMultipleFiles() { + client.multiBinaryParts( + new MultiBinaryPartsRequest(new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg")) + .setPicture( + new PictureFileDetails(BinaryData.fromFile(FileUtils.getPngFile())).setFilename("image.png"))); + + validationPolicy.validateFilenames("image.jpg", "image.png"); + + // "picture" be optional + asyncClient.multiBinaryParts(new MultiBinaryPartsRequest( + new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg"))).block(); + } + + @Test + public void testFileArray() { + client.binaryArrayParts(new BinaryArrayPartsRequest("123", + Arrays.asList(new PicturesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("image1.png"), + new PicturesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("image2.png")))); + + validationPolicy.validateContentTypes("application/octet-stream", "application/octet-stream"); + + // filename contains non-ASCII + asyncClient + .binaryArrayParts( + new BinaryArrayPartsRequest("123", + Arrays.asList(new PicturesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("voilà.png"), + new PicturesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("ima\"\n\rge2.png")))) + .block(); + + validationPolicy.validateFilenames("voilà.png", "ima%22%0A%0Dge2.png"); + } + + @Test + public void testFilenameAndContentType() { + client.checkFileNameAndContentType( + new MultiPartRequest("123", new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("hello.jpg") + .setContentType("image/jpg"))); + } + + @Test + public void testComplex() { + client.fileArrayAndBasic(new ComplexPartsRequest("123", new Address("X"), + new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg"), + Arrays.asList(new PicturesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("image1.png"), + new PicturesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("image2.png")))); + + validationPolicy.validateFilenames("image.jpg", "image1.png", "image2.png"); + } + + @Test + public void testAnonymousModel() { + client.anonymousModel( + new AnonymousModelRequest(new ProfileImageFileDetails(BinaryData.fromFile(FILE)).setFilename("image.jpg"))); + } + + @Test + public void testFileWithHttpPartSpecificContentType() { + httpPartContentTypeClient.imageJpegContentType(new FileWithHttpPartSpecificContentTypeRequest( + new FileSpecificContentType(BinaryData.fromFile(FILE), "hello.jpg"))); + } + + @Test + public void testFileWithHttpPartRequiredContentType() { + httpPartContentTypeClient.requiredContentType(new FileWithHttpPartRequiredContentTypeRequest( + new FileRequiredMetaData(BinaryData.fromFile(FILE), FILENAME, "application/octet-stream"))); + } + + @Test + public void testFileWithHttpPartOptionalContentType() { + httpPartContentTypeClient.optionalContentType(new FileWithHttpPartOptionalContentTypeRequest( + new FileOptionalContentType(BinaryData.fromFile(FILE), FILENAME).setContentType(FILE_CONTENT_TYPE))); + } + + @Test + public void testComplexWithHttpPart() { + FormDataHttpPartsClient client + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataHttpPartsClient(); + + client.jsonArrayAndFileArray(new ComplexHttpPartsModelRequest("123", new Address("X"), + new FileRequiredMetaData(BinaryData.fromFile(FILE), FILENAME, FILE_CONTENT_TYPE), + List.of(new Address("Y"), new Address("Z")), + List.of(new FileRequiredMetaData(BinaryData.fromFile(PNG_FILE), FILENAME + "1", FILE_CONTENT_TYPE), + new FileRequiredMetaData(BinaryData.fromFile(PNG_FILE), FILENAME + "2", FILE_CONTENT_TYPE)))); + } + + @Test + public void testNonStringHttpPart() { + FormDataHttpPartsNonStringClient client + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataHttpPartsNonStringClient(); + + client.floatMethod(new FloatRequest(0.5)); + } + + @Test + public void testUploadFileSpecificContentType() { + FormDataFileClient fileClient + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataFileClient(); + + fileClient.uploadFileSpecificContentType(new UploadFileSpecificContentTypeRequest( + new FileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("image.png"))); + + validationPolicy.validateContentTypes("image/png"); + } + + @Test + public void testUploadFileRequiredFilename() { + FormDataFileClient fileClient + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataFileClient(); + + fileClient.uploadFileRequiredFilename(new UploadFileRequiredFilenameRequest( + new FileWithRequiredFilename(BinaryData.fromFile(PNG_FILE), "image.png"))); + + validationPolicy.validateFilenames("image.png"); + validationPolicy.validateContentTypes("image/png"); + } + + @Test + public void testUploadFileArray() { + FormDataFileClient fileClient + = new MultiPartClientBuilder().addPolicy(validationPolicy).buildFormDataFileClient(); + + fileClient.uploadFileArray(new UploadFileArrayRequest( + Arrays.asList(new FilesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("image1.png"), + new FilesFileDetails(BinaryData.fromFile(PNG_FILE)).setFilename("image2.png")))); + + validationPolicy.validateFilenames("image1.png", "image2.png"); + validationPolicy.validateContentTypes("image/png", "image/png"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/resiliency/servicedriven/ServiceDrivenTests.java b/packages/typespec-java/emitter-tests/src/test/java/resiliency/servicedriven/ServiceDrivenTests.java new file mode 100644 index 0000000000..f240c636fa --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/resiliency/servicedriven/ServiceDrivenTests.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package resiliency.servicedriven; + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ServiceDrivenTests { + + private final resiliency.servicedriven.v1.ResiliencyServiceDrivenClient oldClient1 + = new resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder().endpoint("http://localhost:3000") + .serviceDeploymentVersion("v1") + .buildClient(); + + private final resiliency.servicedriven.v1.ResiliencyServiceDrivenClient oldClient2 + = new resiliency.servicedriven.v1.ResiliencyServiceDrivenClientBuilder().endpoint("http://localhost:3000") + .serviceDeploymentVersion("v2") + .buildClient(); + + private final ResiliencyServiceDrivenClient client2v1 + = new ResiliencyServiceDrivenClientBuilder().endpoint("http://localhost:3000") + .serviceDeploymentVersion("v2") + .serviceVersion(ServiceDrivenServiceVersion.V1) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .buildClient(); + + private final ResiliencyServiceDrivenClient client2v2 + = new ResiliencyServiceDrivenClientBuilder().endpoint("http://localhost:3000") + .serviceDeploymentVersion("v2") + .serviceVersion(ServiceDrivenServiceVersion.V2) + .buildClient(); + + @Test + public void testAddOptionalParamFromNone() { + oldClient1.fromNone(); + oldClient2.fromNone(); + + client2v1.fromNone(); + client2v2.fromNone("new"); + } + + @Test + public void testAddOptionalParamFromOneRequired() { + oldClient1.fromOneRequired("required"); + oldClient2.fromOneRequired("required"); + + client2v1.fromOneRequired("required"); + client2v2.fromOneRequired("required", "new"); + } + + @Test + public void testAddOptionalParamFromOneOptional() { + oldClient1.fromOneOptional("optional"); + oldClient2.fromOneOptional("optional"); + + client2v1.fromOneOptional("optional"); + client2v2.fromOneOptional("optional", "new"); + } + + @Test + public void testAddOperation() { + client2v2.addOperation(); + } + + @Test + public void testInvalidVersion() { + Assertions.assertThrows(IllegalArgumentException.class, () -> client2v1.fromNone("new")); + + Assertions.assertThrows(IllegalArgumentException.class, () -> client2v1.fromOneRequired("required", "new")); + + Assertions.assertThrows(IllegalArgumentException.class, () -> client2v1.fromOneOptional("optional", "new")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/response/statuscoderange/StatusCodeRangeTests.java b/packages/typespec-java/emitter-tests/src/test/java/response/statuscoderange/StatusCodeRangeTests.java new file mode 100644 index 0000000000..a19f94579a --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/response/statuscoderange/StatusCodeRangeTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package response.statuscoderange; + +import com.azure.core.exception.HttpResponseException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class StatusCodeRangeTests { + + private final StatusCodeRangeClient client = new StatusCodeRangeClientBuilder().buildClient(); + + @Test + public void testErrorStatusCodeRange() { + Assertions.assertThrows(HttpResponseException.class, client::errorResponseStatusCodeInRange); + Assertions.assertThrows(HttpResponseException.class, client::errorResponseStatusCode404); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/routes/RouteTests.java b/packages/typespec-java/emitter-tests/src/test/java/routes/RouteTests.java new file mode 100644 index 0000000000..828d2be3ab --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/routes/RouteTests.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package routes; + +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import java.util.List; +import java.util.Set; +import org.junit.jupiter.api.Test; + +public class RouteTests { + + @Test + public void testFixed() { + new RoutesClientBuilder().buildClient().fixed(); + + new RoutesClientBuilder().buildInInterfaceClient().fixed(); + } + + @Test + public void testPath() { + var client = new RoutesClientBuilder().buildPathParametersClient(); + + client.templateOnly("a"); + + client.explicit("a"); + + client.annotationOnly("a"); + } + + @Test + public void testPathReservedExpansion() { + var client = new RoutesClientBuilder().buildPathParametersReservedExpansionClient(); + + // TODO, need enhancement in core or codegen + client.template("foo/bar baz".replace(" ", "%20")); + client.annotation("foo/bar baz".replace(" ", "%20")); + } + + @Test + public void testQuery() { + var client = new RoutesClientBuilder().buildQueryParametersClient(); + + client.templateOnly("a"); + + client.explicit("a"); + + client.annotationOnly("a"); + } + + @Test + public void testQueryExpansionStandard() { + var client = new RoutesClientBuilder().buildQueryParametersQueryExpansionStandardClient(); + + client.primitive("a"); + + client.array(List.of("a", "b")); + } + + @Test + public void testQueryExpansionContinuationStandard() { + var client = new RoutesClientBuilder().buildQueryParametersQueryContinuationStandardClient(); + + client.primitive("a"); + + client.array(List.of("a", "b")); + } + + @Test + public void testQueryExpansionExplode() { + var client = new RoutesClientBuilder().buildQueryParametersQueryExpansionExplodeClient(); + + client.primitive("a"); + + client.array(List.of("a", "b")); + } + + @Test + public void buildQueryParametersQueryContinuationExplode() { + var client = new RoutesClientBuilder() + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .setAllowedQueryParamNames(Set.of("fixed", "param"))) + .buildQueryParametersQueryContinuationExplodeClient(); + + client.primitive("a"); + + client.array(List.of("a", "b")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/serialization/encodedname/json/JsonTests.java b/packages/typespec-java/emitter-tests/src/test/java/serialization/encodedname/json/JsonTests.java new file mode 100644 index 0000000000..f1d508d891 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/serialization/encodedname/json/JsonTests.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package serialization.encodedname.json; + +import org.junit.jupiter.api.Test; + +public class JsonTests { + + private final JsonClient client = new JsonClientBuilder().buildClient(); + + @Test + public void testJson() { + client.send(client.get()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/server/endpoint/notdefined/EndpointTests.java b/packages/typespec-java/emitter-tests/src/test/java/server/endpoint/notdefined/EndpointTests.java new file mode 100644 index 0000000000..8b1025d3cb --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/server/endpoint/notdefined/EndpointTests.java @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package server.endpoint.notdefined; + +import org.junit.jupiter.api.Test; + +public class EndpointTests { + + @Test + public void testEndpoint() { + new NotDefinedClientBuilder().endpoint("http://localhost:3000").buildClient().valid(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/server/path/multiple/MultipleClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/server/path/multiple/MultipleClientTest.java new file mode 100644 index 0000000000..89ac81f3c3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/server/path/multiple/MultipleClientTest.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package server.path.multiple; + +import org.junit.jupiter.api.Test; + +class MultipleClientTest { + + MultipleClient client = new MultipleClientBuilder().endpoint("http://localhost:3000").buildClient(); + + @Test + void noOperationParams() { + client.noOperationParams(); + } + + @Test + void withOperationPathParam() { + client.withOperationPathParam("test"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/server/path/single/SingleClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/server/path/single/SingleClientTest.java new file mode 100644 index 0000000000..88e02d1f40 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/server/path/single/SingleClientTest.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package server.path.single; + +import org.junit.jupiter.api.Test; + +class SingleClientTest { + + SingleClient client = new SingleClientBuilder().endpoint("http://localhost:3000").buildClient(); + + @Test + void myOp() { + client.myOp(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/server/versions/NotVersionedTests.java b/packages/typespec-java/emitter-tests/src/test/java/server/versions/NotVersionedTests.java new file mode 100644 index 0000000000..9ee54e93e1 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/server/versions/NotVersionedTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package server.versions; + +import org.junit.jupiter.api.Test; +import server.versions.notversioned.NotVersionedClient; +import server.versions.notversioned.NotVersionedClientBuilder; + +public class NotVersionedTests { + + private final NotVersionedClient client + = new NotVersionedClientBuilder().endpoint("http://localhost:3000").buildClient(); + + @Test + public void test() { + client.withoutApiVersion(); + + client.withPathApiVersion("v1.0"); + + client.withQueryApiVersion("v1.0"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/server/versions/VersionedTests.java b/packages/typespec-java/emitter-tests/src/test/java/server/versions/VersionedTests.java new file mode 100644 index 0000000000..4bb005e3f6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/server/versions/VersionedTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package server.versions; + +import org.junit.jupiter.api.Test; +import server.versions.versioned.VersionedClient; +import server.versions.versioned.VersionedClientBuilder; +import server.versions.versioned.VersionedServiceVersion; + +public class VersionedTests { + + private final VersionedClient client = new VersionedClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(VersionedServiceVersion.V2022_12_01_PREVIEW) + .buildClient(); + + @Test + public void test() { + client.withoutApiVersion(); + + client.withPathApiVersion(); + + client.withQueryApiVersion(); + + VersionedClient oldClient = new VersionedClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(VersionedServiceVersion.V2021_01_01_PREVIEW) + .buildClient(); + oldClient.withQueryOldApiVersion(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/service/multipleservices/MultipleServicesTests.java b/packages/typespec-java/emitter-tests/src/test/java/service/multipleservices/MultipleServicesTests.java new file mode 100644 index 0000000000..220711164d --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/service/multipleservices/MultipleServicesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package service.multipleservices; + +import org.junit.jupiter.api.Test; +import service.multipleservices.servicea.AOperationsClient; +import service.multipleservices.servicea.ASubNamespaceClient; +import service.multipleservices.servicea.ServiceAClientBuilder; +import service.multipleservices.serviceb.BOperationsClient; +import service.multipleservices.serviceb.BSubNamespaceClient; +import service.multipleservices.serviceb.ServiceBClientBuilder; + +public final class MultipleServicesTests { + + private final AOperationsClient aOperationsClient = new ServiceAClientBuilder().buildAOperationsClient(); + private final ASubNamespaceClient aSubNamespaceClient = new ServiceAClientBuilder().buildASubNamespaceClient(); + private final BOperationsClient bOperationsClient = new ServiceBClientBuilder().buildBOperationsClient(); + private final BSubNamespaceClient bSubNamespaceClient = new ServiceBClientBuilder().buildBSubNamespaceClient(); + + @Test + public void testMultipleServiceClients() { + aOperationsClient.opA(); + aSubNamespaceClient.subOpA(); + bOperationsClient.opB(); + bSubNamespaceClient.subOpB(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/service/multiservice/MultipleServiceTests.java b/packages/typespec-java/emitter-tests/src/test/java/service/multiservice/MultipleServiceTests.java new file mode 100644 index 0000000000..f80736805a --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/service/multiservice/MultipleServiceTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package service.multiservice; + +import org.junit.jupiter.api.Test; +import service.multiservice.combined.BarClient; +import service.multiservice.combined.CombinedBuilder; +import service.multiservice.combined.FooClient; + +public final class MultipleServiceTests { + + private final FooClient fooClient = new CombinedBuilder().buildFooClient(); + private final BarClient barClient = new CombinedBuilder().buildBarClient(); + + @Test + public void testCombinedClient() { + fooClient.test(); + barClient.test(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialheaders/conditionalrequest/ConditionalTests.java b/packages/typespec-java/emitter-tests/src/test/java/specialheaders/conditionalrequest/ConditionalTests.java new file mode 100644 index 0000000000..88065bee2a --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialheaders/conditionalrequest/ConditionalTests.java @@ -0,0 +1,23 @@ +package specialheaders.conditionalrequest; + +import com.azure.core.util.DateTimeRfc1123; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; + +public class ConditionalTests { + + private final ConditionalRequestClient client = new ConditionalRequestClientBuilder().buildClient(); + + private static final OffsetDateTime DATE_TIME = new DateTimeRfc1123("Fri, 26 Aug 2022 14:38:00 GMT").getDateTime(); + + @Test + public void testConditional() { + client.postIfMatch("\"valid\""); + + client.postIfNoneMatch("\"invalid\""); + + client.headIfModifiedSince(DATE_TIME); + + client.postIfUnmodifiedSince(DATE_TIME); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialheaders/repeatability/RepeatabilityTests.java b/packages/typespec-java/emitter-tests/src/test/java/specialheaders/repeatability/RepeatabilityTests.java new file mode 100644 index 0000000000..5b466c67cf --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialheaders/repeatability/RepeatabilityTests.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialheaders.repeatability; + +import org.junit.jupiter.api.Test; + +public class RepeatabilityTests { + + private final RepeatabilityClient client = new RepeatabilityClientBuilder().buildClient(); + + @Test + public void testRepeatability() { + client.immediateSuccess(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialwords/ExtensibleStringsClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ExtensibleStringsClientTest.java new file mode 100644 index 0000000000..633147c06f --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ExtensibleStringsClientTest.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialwords; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import specialwords.extensiblestrings.models.ExtensibleString; + +public class ExtensibleStringsClientTest { + + private final ExtensibleStringsClient client = new SpecialWordsClientBuilder().buildExtensibleStringsClient(); + + @Test + public void testPutExtensibleStringValue() { + ExtensibleString result = client.putExtensibleStringValue(ExtensibleString.CLASS); + Assertions.assertEquals(ExtensibleString.CLASS, result); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialwords/ModelClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ModelClientTest.java new file mode 100644 index 0000000000..c6cfd43ecf --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ModelClientTest.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialwords; + +import com.azure.core.util.BinaryData; +import java.util.Collections; +import org.junit.jupiter.api.Test; + +public class ModelClientTest { + + private final ModelsClient client = new SpecialWordsClientBuilder().buildModelsClient(); + + @Test + public void test() throws Exception { + ReflectHelper.invokeWithResponseMethods(client.getClass(), client, + BinaryData.fromObject(Collections.singletonMap("name", "ok"))); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialwords/ModelPropertyClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ModelPropertyClientTest.java new file mode 100644 index 0000000000..399180dc02 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ModelPropertyClientTest.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialwords; + +import org.junit.jupiter.api.Test; +import specialwords.modelproperties.models.DictMethods; +import specialwords.modelproperties.models.ModelWithList; +import specialwords.modelproperties.models.SameAsModel; + +public class ModelPropertyClientTest { + + private final ModelPropertiesClient client = new SpecialWordsClientBuilder().buildModelPropertiesClient(); + + @Test + public void testSameAsModel() { + client.sameAsModel(new SameAsModel("ok")); + } + + @Test + public void testDictMethods() { + client.dictMethods(new DictMethods("ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok", "ok")); + } + + @Test + public void testWithList() { + client.withList(new ModelWithList("ok")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialwords/OperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/specialwords/OperationClientTest.java new file mode 100644 index 0000000000..b86235c8ae --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialwords/OperationClientTest.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialwords; + +import org.junit.jupiter.api.Test; + +public class OperationClientTest { + + private final OperationsClient client = new SpecialWordsClientBuilder().buildOperationsClient(); + + @Test + public void test() throws Exception { + ReflectHelper.invokeWithResponseMethods(client.getClass(), client); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialwords/ParameterClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ParameterClientTest.java new file mode 100644 index 0000000000..dbb96b19ab --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ParameterClientTest.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialwords; + +import org.junit.jupiter.api.Test; + +public class ParameterClientTest { + + private final ParametersClient client = new SpecialWordsClientBuilder().buildParametersClient(); + + @Test + public void test() throws Exception { + ReflectHelper.invokeWithResponseMethods(client.getClass(), client, "ok"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialwords/ReflectHelper.java b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ReflectHelper.java new file mode 100644 index 0000000000..140565348d --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ReflectHelper.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialwords; + +import com.azure.core.http.rest.RequestOptions; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.stream.Stream; + +// use reflection to call mock server, as special-words test is about compiler, not runtime +class ReflectHelper { + + public static void invokeWithResponseMethods(Class clazz, Object client, Object... parameters) + throws InvocationTargetException, IllegalAccessException { + for (Method m : clazz.getDeclaredMethods()) { + if (m.getName().endsWith("WithResponse")) { + Object[] args + = Stream.concat(Arrays.stream(parameters), Stream.of((RequestOptions) null)).toArray(Object[]::new); + m.invoke(client, args); + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/specialwords/ReservedOperationBodyParamsClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ReservedOperationBodyParamsClientTest.java new file mode 100644 index 0000000000..6adca3a731 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/specialwords/ReservedOperationBodyParamsClientTest.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package specialwords; + +import java.util.Collections; +import org.junit.jupiter.api.Test; + +public class ReservedOperationBodyParamsClientTest { + + private final ReservedOperationBodyParamsClient client + = new SpecialWordsClientBuilder().buildReservedOperationBodyParamsClient(); + + @Test + public void testWithItems() { + client.withItems(Collections.singletonList("item")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/streaming/jsonl/JsonlTests.java b/packages/typespec-java/emitter-tests/src/test/java/streaming/jsonl/JsonlTests.java new file mode 100644 index 0000000000..c78d567b50 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/streaming/jsonl/JsonlTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package streaming.jsonl; + +import com.azure.core.util.BinaryData; +import java.util.List; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class JsonlTests { + + private final JsonlClient client = new JsonlClientBuilder().buildClient(); + + @Test + public void testJsonl() { + String jsonlStream = List.of("{\"desc\": \"one\"}", "{\"desc\": \"two\"}", "{\"desc\": \"three\"}") + .stream() + .collect(Collectors.joining("\n")); + client.send(BinaryData.fromString(jsonlStream)); + + BinaryData data = client.receive(); + Assertions.assertEquals(3, data.toString().split("\n").length); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/arm/LroResponseTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/arm/LroResponseTests.java new file mode 100644 index 0000000000..a8f9f19908 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/arm/LroResponseTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.arm; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import tsptest.armresourceprovider.ArmResourceProviderManager; +import tsptest.armresourceprovider.models.ActionFinalResult; + +public class LroResponseTests { + + // compile pass + public void testLroActionFinalResponse() { + ArmResourceProviderManager manager = Mockito.mock(ArmResourceProviderManager.class); + ActionFinalResult actionFinalResult = manager.lroNoBodies().action("resourceGroup", "name"); + } + + @Test + public void testLroActionInitiateResponseNotGenerated() throws ClassNotFoundException { + // ActionFinalResult generated + this.getClass().getClassLoader().loadClass("tsptest.armresourceprovider.models.ActionFinalResult"); + // ActionInitiateResult not generated + Assertions.assertThrows(ClassNotFoundException.class, () -> { + this.getClass().getClassLoader().loadClass("tsptest.armresourceprovider.models.ActionInitiateResult"); + }); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/armstreamstyleserialization/PagedModelPackageTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/armstreamstyleserialization/PagedModelPackageTests.java new file mode 100644 index 0000000000..acc5506f35 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/armstreamstyleserialization/PagedModelPackageTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.armstreamstyleserialization; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.armstreamstyleserialization.fluent.models.ListResultSummary2Inner; +import tsptest.armstreamstyleserialization.implementation.models.ListResult; +import tsptest.armstreamstyleserialization.implementation.models.ListResultSummary; +import tsptest.armstreamstyleserialization.models.ListResult2; +import tsptest.armstreamstyleserialization.models.ListResult3; + +public class PagedModelPackageTests { + + @Test + public void testPagedModelPackage() { + Assertions.assertTrue(isInImplementationModels(ListResult.class)); + Assertions.assertTrue(isInImplementationModels(ListResultSummary.class)); + + // ListResult2 not in implementation, because its child ListResultSummary2(Inner) is PUBLIC + Assertions.assertFalse(isInImplementationModels(ListResult2.class)); + Assertions.assertFalse(isInImplementationModels(ListResultSummary2Inner.class)); + + // ListResult3 not in implementation, because we add `@access(Access.public)` to the model + Assertions.assertFalse(isInImplementationModels(ListResult3.class)); + } + + private static boolean isInImplementationModels(Class clazz) { + return clazz.getPackage().getName().endsWith(".implementation.models"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/armstreamstyleserialization/StreamStyleSerializationTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/armstreamstyleserialization/StreamStyleSerializationTests.java new file mode 100644 index 0000000000..8521d76f97 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/armstreamstyleserialization/StreamStyleSerializationTests.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.armstreamstyleserialization; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.json.JsonProviders; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.io.StringWriter; +import java.nio.charset.StandardCharsets; +import java.time.Instant; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.ArmUtils; +import reactor.core.publisher.Mono; +import tsptest.armstreamstyleserialization.fluent.models.FunctionConfiguration; +import tsptest.armstreamstyleserialization.models.ErrorMax; +import tsptest.armstreamstyleserialization.models.Priority; +import tsptest.armstreamstyleserialization.models.SawShark; +import tsptest.armstreamstyleserialization.models.Shark; + +public class StreamStyleSerializationTests { + @Test + public void testDuplicatePropertiesSerialization() throws IOException { + // SawShark has "age" property in both itself, and its parent "Fish". + int age = 10; + SawShark model = new SawShark().withAge(age).withDna("upi"); + StringWriter stringWriter = new StringWriter(); + JsonWriter jsonWriter = JsonProviders.createWriter(stringWriter); + model.toJson(jsonWriter); + jsonWriter.flush(); + model = BinaryData.fromString(stringWriter.toString()).toObject(SawShark.class); + Assertions.assertEquals(age, model.age()); + } + + @Test + public void testManagementErrorDeserialization() throws IOException { + final String errorBodyWithError + = "{\"error\":{\"code\":\"WepAppError\",\"message\":\"Web app error.\",\"additionalProperty\":\"Deployment error.\",\"details\":[{\"code\":\"InnerError\", \"additionalProperty\": \"nested\"}]}}"; + final String errorBodyWithoutError + = "{\"code\":\"WepAppError\",\"message\":\"Web app error.\",\"additionalProperty\":\"Deployment error.\",\"details\":[{\"code\":\"InnerError\", \"additionalProperty\": \"nested\"}]}"; + SerializerAdapter serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + ErrorMax error = serializerAdapter.deserialize(errorBodyWithError, ErrorMax.class, SerializerEncoding.JSON); + Assertions.assertEquals("WepAppError", error.getCode()); + Assertions.assertEquals("Deployment error.", error.getAdditionalProperty()); + Assertions.assertEquals("nested", error.getDetails().iterator().next().getAdditionalProperty()); + + error = serializerAdapter.deserialize(errorBodyWithoutError, ErrorMax.class, SerializerEncoding.JSON); + Assertions.assertEquals("WepAppError", error.getCode()); + Assertions.assertEquals("Deployment error.", error.getAdditionalProperty()); + Assertions.assertEquals("nested", error.getDetails().iterator().next().getAdditionalProperty()); + } + + @Test + public void testValidate() { + Shark shark = new Shark(); + Assertions.assertThrows(IllegalArgumentException.class, shark::validate); + + shark.withAge(1); + shark.withRequiredString("any"); + Assertions.assertThrows(IllegalArgumentException.class, shark::validate); + + shark.withRequiredStringAnotherPropertiesRequiredString("any"); + shark.validate(); + } + + @Test + public void testExpandableEnum() { + HttpClient httpClient = createExpandableEnumHttpClient(); + // normal case + ArmResourceProviderManager manager = ArmResourceProviderManager + .authenticate(new HttpPipelineBuilder().httpClient(httpClient).build(), ArmUtils.getAzureProfile()); + Priority priority = manager.priorities().setPriority(Priority.HIGH); + Assertions.assertEquals(Priority.HIGH, priority); + + // null case + priority = manager.priorities().setPriority(Priority.HIGH); + Assertions.assertNull(priority); + + // exception case, expected number, but received string + // azure-json wraps IllegalArgumentException + Assertions.assertThrows(RuntimeException.class, () -> manager.priorities().setPriority(Priority.HIGH)); + } + + @Test + @SuppressWarnings("unchecked") + public void testPropertyWithNullValue() { + FunctionConfiguration functionConfiguration = new FunctionConfiguration(); + Map jsonDict + = (Map) BinaryData.fromObject(functionConfiguration).toObject(Map.class); + Assertions.assertTrue(jsonDict.containsKey("input")); + Assertions.assertNull(jsonDict.get("input")); + Assertions.assertFalse(jsonDict.containsKey("output")); + + functionConfiguration = new FunctionConfiguration().withInput("input"); + jsonDict = (Map) BinaryData.fromObject(functionConfiguration).toObject(Map.class); + Assertions.assertTrue(jsonDict.containsKey("input")); + Assertions.assertEquals("input", jsonDict.get("input")); + } + + public final static class TestBinary implements JsonSerializable { + private Map unknownDict; + + public Map unknownDict() { + return this.unknownDict; + } + + public TestBinary() { + } + + public TestBinary withUnknownDict(Map unknownDict) { + this.unknownDict = unknownDict; + return this; + } + + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("unknownDict", this.unknownDict, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + return jsonWriter.writeEndObject(); + } + + public static TestBinary fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TestBinary deserializedTestBinary = new TestBinary(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("unknownDict".equals(fieldName)) { + Map unknownDict = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + deserializedTestBinary.unknownDict = unknownDict; + } else { + reader.skipChildren(); + } + } + + return deserializedTestBinary; + }); + } + } + + @Test + @SuppressWarnings("unchecked") + public void testBinaryDataInContainer() { + // use a simple class + TestBinary model = new TestBinary().withUnknownDict( + Map.of("string", BinaryData.fromString("\"value\""), "object", BinaryData.fromString("{\"k\", \"v\"}"))); + + com.azure.core.util.BinaryData binaryData = BinaryData.fromObject(model); + String jsonString = binaryData.toString(); + Map jsonMap = BinaryData.fromString(jsonString).toObject(Map.class); + Assertions.assertTrue(jsonMap.containsKey("unknownDict")); + Map unknownDict = (Map) jsonMap.get("unknownDict"); + Assertions.assertEquals("\"value\"", unknownDict.get("string")); + Assertions.assertEquals("{\"k\", \"v\"}", unknownDict.get("object")); + + model = binaryData.toObject(TestBinary.class); + } + + @Test + public void ensureInstantMaxValue() { + // ensure Integer.MAX_VALUE doesn't exceeds Instant.MAX + Instant.ofEpochSecond(Integer.MAX_VALUE); + } + + private static HttpClient createExpandableEnumHttpClient() { + AtomicInteger callCount = new AtomicInteger(); + HttpClient httpClient = request -> { + int count = callCount.incrementAndGet(); + String query = request.getUrl().getQuery(); + Assertions.assertEquals("priority=0", query); + if (count == 1) { + // normal case + return Mono.just(new MockHttpResponse(request, 200, "0".getBytes(StandardCharsets.UTF_8))); + } else if (count == 2) { + // null case + return Mono.just(new MockHttpResponse(request, 200, "null".getBytes(StandardCharsets.UTF_8))); + } else { + // exception case, expected number, but received string + return Mono.just(new MockHttpResponse(request, 200, "\"abc\"".getBytes(StandardCharsets.UTF_8))); + } + }; + return httpClient; + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/armversioned/ArmVersionedTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/armversioned/ArmVersionedTests.java new file mode 100644 index 0000000000..14310a475c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/armversioned/ArmVersionedTests.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.armversioned; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import org.mockito.Mockito; +import tsptest.armversioned.fluent.models.TopLevelArmResourceInner; +import tsptest.armversioned.models.TopLevelArmResource; + +public class ArmVersionedTests { + + // only to test compilation + public void testVersionedApi() { + ArmVersionedManager manager = Mockito.mock(ArmVersionedManager.class); + TopLevelArmResourceInner resourceInner = Mockito.mock(TopLevelArmResourceInner.class); + + // API without optional parameter + // this API exists in all versions + manager.topLevelArmResources().list(); + + manager.topLevelArmResources().listByResourceGroup("resourceGroup"); + + manager.topLevelArmResources().action("resourceGroup", "resourceName"); + + manager.serviceClient() + .getTopLevelArmResources() + .createOrUpdate("resourceGroup", "resourceName", resourceInner); + TopLevelArmResource resource = manager.topLevelArmResources() + .define("resourceName") + .withRegion(Region.US_WEST3) + .withExistingResourceGroup("resourceGroup") + .create(); + + resource.update().apply(); + + manager.topLevelArmResources().delete("resourceGroup", "resourceName"); + manager.topLevelArmResources().deleteById("id"); + + resource.refresh(); + + // API in 2024-12-01 + manager.topLevelArmResources().list("parameter", "newParameter", Context.NONE); + + manager.topLevelArmResources().listByResourceGroup("resourceGroup", "parameter", "newParameter", Context.NONE); + + manager.topLevelArmResources() + .actionWithResponse("resourceGroup", "resourceName", "parameter", "newParameter", Context.NONE); + + manager.serviceClient() + .getTopLevelArmResources() + .createOrUpdate("resourceGroup", "resourceName", resourceInner, "parameter", "newParameter", Context.NONE); + manager.topLevelArmResources() + .define("resourceName") + .withRegion(Region.US_WEST3) + .withExistingResourceGroup("resourceGroup") + .withParameter("parameter") + .withNewParameter("newParameter") + .create(); + + resource.update().withParameter("parameter").withNewParameter("newParameter").apply(); + + manager.topLevelArmResources() + .deleteWithResponse("resourceGroup", "resourceName", "parameter", "newParameter", Context.NONE); + manager.topLevelArmResources().deleteByIdWithResponse("id", "parameter", "newParameter", Context.NONE); + + // API in 2023-12-01 + // this op will be generated, if tspconfig has "advanced-versioning" option + // REST API allow adding optional parameter to operation + manager.topLevelArmResources().list("parameter", Context.NONE); + + manager.topLevelArmResources().listByResourceGroup("resourceGroup", "parameter", Context.NONE); + + manager.topLevelArmResources().actionWithResponse("resourceGroup", "resourceName", "parameter", Context.NONE); + + manager.serviceClient() + .getTopLevelArmResources() + .createOrUpdate("resourceGroup", "resourceName", resourceInner, "parameter", Context.NONE); + manager.topLevelArmResources() + .define("resourceName") + .withRegion(Region.US_WEST3) + .withExistingResourceGroup("resourceGroup") + .withParameter("parameter") + .create(); + + resource.update().withParameter("parameter").apply(); + + manager.topLevelArmResources().deleteWithResponse("resourceGroup", "resourceName", "parameter", Context.NONE); + manager.topLevelArmResources().deleteByIdWithResponse("id", "parameter", Context.NONE); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/ClientOptionsTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/ClientOptionsTests.java new file mode 100644 index 0000000000..26a54ee257 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/ClientOptionsTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.builtin; + +import com.azure.core.http.HttpHeader; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.core.util.ClientOptions; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public class ClientOptionsTests { + + @Test + public void testClientOptions() { + BuiltinClient client = new BuiltinClientBuilder().endpoint("http://localhost:3000") + .clientOptions(new ClientOptions() + .setHeaders(Arrays.asList(new HttpHeader("header1", "value1"), new HttpHeader("header2", "value2")))) + .httpClient(request -> { + Assertions.assertEquals("value1", request.getHeaders().getValue(HttpHeaderName.fromString("header1"))); + Assertions.assertEquals("value2", request.getHeaders().getValue(HttpHeaderName.fromString("header2"))); + return Mono + .just(new MockHttpResponse(request, 200, new HttpHeaders(), "{}".getBytes(StandardCharsets.UTF_8))); + }) + .buildClient(); + + client.read("", ""); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/EncodeTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/EncodeTests.java new file mode 100644 index 0000000000..ec4e5ba900 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/EncodeTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.builtin; + +import com.azure.core.util.BinaryData; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.builtin.models.Encoded; + +public class EncodeTests { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + private static final OffsetDateTime DATE = OffsetDateTime.parse("2019-10-12T07:20:50.52Z"); + private static final byte[] DATA = "data".getBytes(StandardCharsets.UTF_8); + + @Test + public void testEncoded() throws Exception { + Duration timeInSeconds = Duration.ofSeconds(5); + Duration timeInSecondsFraction = Duration.ofMillis(1500); + + Encoded encoded = new Encoded(); + encoded.setTimeInSeconds(timeInSeconds); + encoded.setTimeInSecondsFraction(timeInSecondsFraction); + encoded.setDateTime(DATE); + encoded.setDateTimeRfc7231(DATE); + encoded.setUnixTimestamp(DATE); + encoded.setBase64(DATA); + encoded.setBase64url(DATA); + + Assertions.assertEquals(timeInSeconds, encoded.getTimeInSeconds()); + Assertions.assertEquals(timeInSecondsFraction, encoded.getTimeInSecondsFraction()); + + BinaryData json = BinaryData.fromObject(encoded); + + JsonNode jsonNode = OBJECT_MAPPER.readTree(json.toString()); + double timeInSecondsInJson = jsonNode.get("timeInSeconds").asDouble(); + double timeInSecondsFractionInJson = jsonNode.get("timeInSecondsFraction").asDouble(); + Assertions.assertEquals(5, timeInSecondsInJson); + Assertions.assertEquals(1.5, timeInSecondsFractionInJson); + Assertions.assertEquals(DATE, OffsetDateTime.parse(jsonNode.get("dateTime").asText())); + Assertions.assertEquals("Sat, 12 Oct 2019 07:20:50 GMT", jsonNode.get("dateTimeRfc7231").asText()); + Assertions.assertEquals(1570864850L, jsonNode.get("unixTimestamp").asLong()); + Assertions.assertEquals("ZGF0YQ==", jsonNode.get("base64").asText()); + Assertions.assertEquals("ZGF0YQ", jsonNode.get("base64url").asText()); + + String jsonStr = jsonNode.toString(); + Encoded encoded2 = BinaryData.fromString(jsonStr).toObject(Encoded.class); + Assertions.assertEquals(timeInSeconds, encoded2.getTimeInSeconds()); + Assertions.assertEquals(timeInSecondsFraction, encoded2.getTimeInSecondsFraction()); + Assertions.assertEquals(DATE, encoded2.getDateTime()); + Assertions.assertEquals(DATE.withNano(0), encoded2.getDateTimeRfc7231()); // correct to seconds + Assertions.assertEquals(DATE.withNano(0), encoded2.getUnixTimestamp()); // correct to seconds + Assertions.assertArrayEquals(DATA, encoded2.getBase64()); + Assertions.assertArrayEquals(DATA, encoded2.getBase64url()); + } + + @Test + public void testEncodedDurationInvalidPrecision() { + Duration timeInSeconds = Duration.ofMillis(5700); + + Encoded encoded = new Encoded(); + encoded.setTimeInSeconds(timeInSeconds); + + // since the wire type is long (in seconds), 5.7 seconds will be 5 seconds + Assertions.assertEquals(5, encoded.getTimeInSeconds().getSeconds()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/ExceptionTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/ExceptionTests.java new file mode 100644 index 0000000000..de414fee85 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/builtin/ExceptionTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.builtin; + +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpHeaders; +import com.azure.core.test.http.MockHttpResponse; +import java.nio.charset.StandardCharsets; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public class ExceptionTests { + + @Test + public void testExceptionValue() { + String responseStr = "{\"error\":{\"code\":\"RESOURCE_NOT_FOUND\",\"message\":\"resource not found\"}}"; + + BuiltinAsyncClient client = new BuiltinClientBuilder().endpoint("http://localhost:3000") + .httpClient(request -> Mono.just( + new MockHttpResponse(request, 404, new HttpHeaders(), responseStr.getBytes(StandardCharsets.UTF_8)))) + .buildAsyncClient(); + + try { + client.read("q", "q").block(); + } catch (ResourceNotFoundException e) { + // TODO (weidxu) fix + // org.opentest4j.AssertionFailedError: + // Expected :class com.azure.core.models.ResponseError + // Actual :class java.util.LinkedHashMap + // Assertions.assertEquals(ResponseError.class, e.getValue().getClass()); + } + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/enumservice/EnumTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/enumservice/EnumTests.java new file mode 100644 index 0000000000..6ce8a287ac --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/enumservice/EnumTests.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.enumservice; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpMethod; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.BinaryData; +import java.lang.reflect.Field; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.List; +import java.util.function.Consumer; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Mono; +import tsptest.enumservice.implementation.EnumServiceClientImpl; +import tsptest.enumservice.models.ColorModel; +import tsptest.enumservice.models.Priority; +import tsptest.enumservice.models.PriorityModel; + +public class EnumTests { + + @SuppressWarnings("unchecked") + @Test + public void testStringArrayInParameter() throws Exception { + EnumServiceClientImpl impl = Mockito.mock(EnumServiceClientImpl.class); + + ArgumentCaptor> enumArrayArgumentCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor requestOptionsArgumentCaptor = ArgumentCaptor.forClass(RequestOptions.class); + + Mockito + .when(impl.setStringEnumArrayWithResponseAsync(enumArrayArgumentCaptor.capture(), + requestOptionsArgumentCaptor.capture())) + .thenReturn(Mono.just(new SimpleResponse<>(null, 200, new HttpHeaders(), BinaryData.fromString("\"OK\"")))); + + EnumServiceAsyncClient client = new EnumServiceAsyncClient(impl); + + // normal case + client + .setStringEnumArray(Arrays.asList(ColorModel.BLUE, ColorModel.GREEN), + Arrays.asList(ColorModel.GREEN, ColorModel.RED)) + .block(); + + Assertions.assertEquals(Arrays.asList(ColorModel.BLUE.toString(), ColorModel.GREEN.toString()), + enumArrayArgumentCaptor.getValue()); + + HttpRequest request = new HttpRequest(HttpMethod.POST, "http://endpoint/"); + getRequestCallback(requestOptionsArgumentCaptor.getValue()).accept(request); + verifyQuery(request.getUrl().getQuery(), "colorArrayOpt", + String.join(",", Arrays.asList(ColorModel.GREEN.toString(), ColorModel.RED.toString()))); + + // case: array contains null + client.setStringEnumArray(Arrays.asList(ColorModel.BLUE, null), Arrays.asList(null, ColorModel.RED)).block(); + + Assertions.assertEquals(Arrays.asList(ColorModel.BLUE.toString(), ""), enumArrayArgumentCaptor.getValue()); + + request = new HttpRequest(HttpMethod.POST, "http://endpoint/"); + getRequestCallback(requestOptionsArgumentCaptor.getValue()).accept(request); + verifyQuery(request.getUrl().getQuery(), "colorArrayOpt", "," + ColorModel.RED); + } + + @SuppressWarnings("unchecked") + @Test + public void testIntArrayInParameter() throws Exception { + EnumServiceClientImpl impl = Mockito.mock(EnumServiceClientImpl.class); + + ArgumentCaptor> enumArrayArgumentCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor requestOptionsArgumentCaptor = ArgumentCaptor.forClass(RequestOptions.class); + + Mockito + .when(impl.setIntEnumArrayWithResponseAsync(enumArrayArgumentCaptor.capture(), + requestOptionsArgumentCaptor.capture())) + .thenReturn(Mono.just(new SimpleResponse<>(null, 200, new HttpHeaders(), null))); + + EnumServiceAsyncClient client = new EnumServiceAsyncClient(impl); + + // normal case + client.setIntEnumArray(Arrays.asList(Priority.HIGH, Priority.LOW), Arrays.asList(Priority.LOW, Priority.HIGH)) + .block(); + + Assertions.assertEquals(Arrays.asList("100", "0"), enumArrayArgumentCaptor.getValue()); + + HttpRequest request = new HttpRequest(HttpMethod.POST, "http://endpoint/"); + getRequestCallback(requestOptionsArgumentCaptor.getValue()).accept(request); + verifyQuery(request.getUrl().getQuery(), "priorityArrayOpt", "0,100"); + + // case: array contains null + client.setIntEnumArray(Arrays.asList(Priority.HIGH, null), Arrays.asList(null, Priority.HIGH)).block(); + + Assertions.assertEquals(Arrays.asList("100", ""), enumArrayArgumentCaptor.getValue()); + + request = new HttpRequest(HttpMethod.POST, "http://endpoint/"); + getRequestCallback(requestOptionsArgumentCaptor.getValue()).accept(request); + verifyQuery(request.getUrl().getQuery(), "priorityArrayOpt", ",100"); + } + + @SuppressWarnings("unchecked") + @Test + public void testStringArrayAsMulti() throws Exception { + EnumServiceClientImpl impl = Mockito.mock(EnumServiceClientImpl.class); + + ArgumentCaptor> enumArrayArgumentCaptor = ArgumentCaptor.forClass(List.class); + ArgumentCaptor requestOptionsArgumentCaptor = ArgumentCaptor.forClass(RequestOptions.class); + + Mockito + .when(impl.setStringEnumMultiWithResponseAsync(enumArrayArgumentCaptor.capture(), + requestOptionsArgumentCaptor.capture())) + .thenReturn(Mono.just(new SimpleResponse<>(null, 200, new HttpHeaders(), null))); + + EnumServiceAsyncClient client = new EnumServiceAsyncClient(impl); + + // normal case + client + .setStringEnumMulti(Arrays.asList(ColorModel.BLUE, ColorModel.GREEN), + Arrays.asList(ColorModel.GREEN, ColorModel.RED)) + .block(); + + Assertions.assertEquals(Arrays.asList(ColorModel.BLUE.toString(), ColorModel.GREEN.toString()), + enumArrayArgumentCaptor.getValue()); + + HttpRequest request = new HttpRequest(HttpMethod.POST, "http://endpoint/"); + getRequestCallback(requestOptionsArgumentCaptor.getValue()).accept(request); + Assertions.assertEquals("colorArrayOpt=Green&colorArrayOpt=Red", request.getUrl().getQuery()); + } + + @Test + public void testExpandableEnum() { + Assertions.assertEquals(PriorityModel.HIGH, PriorityModel.fromValue(100)); + Assertions.assertNotEquals(PriorityModel.HIGH, PriorityModel.LOW); + Assertions.assertNotEquals(PriorityModel.HIGH, PriorityModel.fromValue(200)); + + Assertions.assertEquals(100, PriorityModel.HIGH.getValue()); + } + + private static void verifyQuery(String query, String key, String value) { + Assertions.assertEquals( + URLEncoder.encode(key, StandardCharsets.UTF_8) + "=" + URLEncoder.encode(value, StandardCharsets.UTF_8), + query); + } + + @SuppressWarnings("unchecked") + private static Consumer getRequestCallback(RequestOptions requestOptions) + throws NoSuchFieldException, IllegalAccessException { + Field field = RequestOptions.class.getDeclaredField("requestCallback"); + field.setAccessible(true); + return (Consumer) field.get(requestOptions); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/errormodel/ResponseErrorTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/errormodel/ResponseErrorTests.java new file mode 100644 index 0000000000..d448d91d89 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/errormodel/ResponseErrorTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.errormodel; + +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.errormodel.models.Diagnostic; + +public class ResponseErrorTests { + + @Test + public void testResponseError() { + String json = "{\"name\": \"diagnostic\", \"error\": {\"code\": \"error\", \"message\": \"error message\"}}"; + Diagnostic diagnostic = BinaryData.fromString(json).toObject(Diagnostic.class); + Assertions.assertEquals("error", diagnostic.getError().getCode()); + Assertions.assertEquals("error message", diagnostic.getError().getMessage()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/flatten/FlattenTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/flatten/FlattenTests.java new file mode 100644 index 0000000000..99e9b4f1c7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/flatten/FlattenTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.flatten; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.core.util.BinaryData; +import com.azure.core.util.UrlBuilder; +import java.util.concurrent.atomic.AtomicReference; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; +import tsptest.flatten.implementation.FlattenClientImpl; +import tsptest.flatten.models.User; + +public class FlattenTests { + + @Test + public void testFlatten() { + AtomicReference idCaptor = new AtomicReference<>(); + AtomicReference payloadCaptor = new AtomicReference<>(); + + HttpPipeline pipeline = new HttpPipelineBuilder().httpClient(request -> { + payloadCaptor.set(request.getBodyAsBinaryData()); + idCaptor.set(UrlBuilder.parse(request.getUrl()).getQuery().get("id")); + return Mono.just(new MockHttpResponse(request, 200)); + }).build(); + FlattenClientImpl impl + = new FlattenClientImpl(pipeline, "https://localhost", FlattenServiceVersion.V2022_06_01_PREVIEW); + FlattenAsyncClient client = new FlattenAsyncClient(impl); + + client.send("id1", "host", "input1", 11, 50, new User("user1")).block(); + + Assertions.assertEquals("id1", idCaptor.get()); + Assertions.assertEquals( + "{\"endpoint\":\"host\",\"input\":\"input1\",\"constant\":\"constant\",\"requiredInt\":11,\"user\":{\"user\":\"user1\"}}", + payloadCaptor.get().toString()); + + client.send("id2", "host", "input2", 11).block(); + + Assertions.assertEquals("id2", idCaptor.get()); + Assertions.assertEquals( + "{\"endpoint\":\"host\",\"input\":\"input2\",\"constant\":\"constant\",\"requiredInt\":11}", + payloadCaptor.get().toString()); + + client.sendOptionalBody("my name").block(); + Assertions.assertEquals("{\"name\":\"my name\"}", payloadCaptor.get().toString()); + + client.sendOptionalBody().block(); + Assertions.assertEquals("{}", payloadCaptor.get().toString()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/patch/PatchClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/patch/PatchClientTest.java new file mode 100644 index 0000000000..8dd64d9c50 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/patch/PatchClientTest.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.patch; + +import com.azure.core.util.BinaryData; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.JsonNodeType; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.patch.implementation.JsonMergePatchHelper; +import tsptest.patch.models.Fish; +import tsptest.patch.models.InnerModel; +import tsptest.patch.models.Resource; +import tsptest.patch.models.Salmon; +import tsptest.patch.models.Shark; + +public class PatchClientTest { + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + @Test + public void testSerializationForNumbers() throws JsonProcessingException { + Resource resource = new Resource(); + resource.setIntValue(null); + resource.setLongValue(null); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + JsonNode node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("longValue").getNodeType()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("intValue").getNodeType()); + } + + @Test + public void testSerializationForString() throws JsonProcessingException { + Resource resource = new Resource(); + resource.setDescription(null); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + JsonNode node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("description").getNodeType()); + } + + @Test + public void testSerializationForNestedModelProperty() throws JsonProcessingException { + Resource resource = new Resource(); + resource.setInnerModelProperty(new InnerModel()); + + // serialize for inner model property + resource.getInnerModelProperty().setDescription(null); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + JsonNode node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, + node.get("wireNameForInnerModelProperty").get("description").getNodeType()); + + // serialize for outer model property + resource.setInnerModelProperty(null); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("wireNameForInnerModelProperty").getNodeType()); + } + + @Test + public void testSerializationForMapProperty() throws JsonProcessingException { + Resource resource = new Resource(); + Map map = new HashMap<>(); + map.put("key", null); + resource.setMap(map); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + JsonNode node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("map").get("key").getNodeType()); + } + + @Test + public void testSerializationForMapNullKeyProperty() { + Exception exception = Assertions.assertThrows(NullPointerException.class, () -> { + Resource resource = new Resource(); + Map map = new HashMap<>(); + resource.setMap(map); + map.put(null, new InnerModel()); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + }); + + String expectedMessage = "'fieldName' cannot be null."; + String actualMessage = exception.getMessage(); + + Assertions.assertTrue(actualMessage.contains(expectedMessage)); + } + + @Test + public void testSerializationForArrayProperty() throws JsonProcessingException { + Resource resource = new Resource(); + resource.setArray(Arrays.asList(new InnerModel().setName("value1"), new InnerModel().setName("value2"))); + Map map = new HashMap<>(); + map.put("key", null); + resource.setMap(map); + resource.getArray().set(0, null); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + JsonNode node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("map").get("key").getNodeType()); + Assertions.assertEquals(2, node.get("array").size()); + Assertions.assertTrue(node.get("array").get(0).isNull()); + Assertions.assertEquals("value2", node.get("array").get(1).get("name").asText()); + } + + @Test + public void testSerializationForEnumProperty() throws JsonProcessingException { + Resource resource = new Resource(); + resource.setEnumValue(null); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + JsonNode node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("enumValue").getNodeType()); + } + + @Test + public void testSerializationForHierarchicalProperty() throws JsonProcessingException { + Resource resource = new Resource(); + Fish shark = new Shark().setAge(2); + shark.setColor(null); + resource.setFish(shark); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, true); + BinaryData data = BinaryData.fromObject(resource); + data.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resource, false); + JsonNode node = OBJECT_MAPPER.readTree(data.toString()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("fish").get("color").getNodeType()); + Assertions.assertEquals("shark", node.get("fish").get("kind").asText()); + Assertions.assertEquals(2, node.get("fish").get("age").asInt()); + } + + @Test + public void testSerializationForHierarchicalModel() throws JsonProcessingException { + Fish fish = new Salmon().setAge(1); + fish.setColor(null); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, true); + BinaryData fishData = BinaryData.fromObject(fish); + fishData.getLength(); // fire serialization + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(fish, false); + JsonNode node = OBJECT_MAPPER.readTree(fishData.toString()); + Assertions.assertEquals("salmon", fish.getKind()); + Assertions.assertEquals(JsonNodeType.NULL, node.get("color").getNodeType()); + + Salmon salmon = new Salmon().setAge(2); + salmon.setColor(null); + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(salmon, true); + BinaryData salmonData = BinaryData.fromObject(salmon); + salmonData.getLength(); // fire serialization + JsonMergePatchHelper.getFishAccessor().prepareModelForJsonMergePatch(salmon, false); + JsonNode nodeSalmon = OBJECT_MAPPER.readTree(salmonData.toString()); + Assertions.assertEquals("salmon", salmon.getKind()); + Assertions.assertEquals(JsonNodeType.NULL, nodeSalmon.get("color").getNodeType()); + } + + @Test + public void testSerializePropertiesInUpdatedPropertiesMapOnly() throws JsonProcessingException { + Resource resource = new Resource(); + resource.setDescription("my desc"); + resource.setIntValue(1); + // update resource, only int value property is updated, so description property should not be in payload + Resource resourceToUpdate = BinaryData.fromObject(resource).toObject(Resource.class); + resourceToUpdate.setIntValue(null); + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resourceToUpdate, true); + BinaryData resourceData = BinaryData.fromObject(resourceToUpdate); + resourceData.getLength(); // fire serialization + JsonMergePatchHelper.getResourceAccessor().prepareModelForJsonMergePatch(resourceToUpdate, false); + JsonNode node = OBJECT_MAPPER.readTree(resourceData.toString()); + Assertions.assertNull(node.get("description")); + Assertions.assertEquals(JsonNodeType.NULL, node.get("intValue").getNodeType()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/subclass/SubclassPropertyTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/subclass/SubclassPropertyTests.java new file mode 100644 index 0000000000..0d425cbad4 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/subclass/SubclassPropertyTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.subclass; + +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.subclass.models.PropertyChangedToConstant; +import tsptest.subclass.models.PropertyChangedToRequired; + +public class SubclassPropertyTests { + + @Test + public void testPropertyChangedToRequired() { + PropertyChangedToRequired model = new PropertyChangedToRequired("value"); + String json = BinaryData.fromObject(model).toString(); + Assertions.assertEquals("{\"propertyChangedToRequired\":\"value\"}", json); + + model = BinaryData.fromString(json).toObject(PropertyChangedToRequired.class); + Assertions.assertEquals("value", model.getPropertyChangedToRequired()); + } + + @Test + public void testPropertyChangedToConstant() { + PropertyChangedToConstant model = new PropertyChangedToConstant(); + String json = BinaryData.fromObject(model).toString(); + Assertions.assertEquals("{\"propertyChangedToConstant\":\"constantValue\"}", json); + + model = BinaryData.fromString(json).toObject(PropertyChangedToConstant.class); + Assertions.assertEquals("constantValue", model.getPropertyChangedToConstant()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/union/UnionTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/union/UnionTests.java new file mode 100644 index 0000000000..eff36b60fd --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/union/UnionTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.union; + +import com.azure.core.util.BinaryData; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.Collections; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.union.implementation.models.SubResult; +import tsptest.union.models.Result; + +public class UnionTests { + + private static final byte[] BYTES = new byte[] { 'a' }; + + @Test + public void testSerialization() throws IOException { + // test non-null Union (required property) + Result result = new Result("name", BinaryData.fromObject(BYTES)); + BinaryData json = BinaryData.fromObject(result); + result = json.toObject(Result.class); + Assertions.assertNotNull(result.getData()); + + // test null Union (optional property) + SubResult subResult = new SubResult("name", BinaryData.fromObject(BYTES)); + json = BinaryData.fromObject(subResult); + subResult = json.toObject(SubResult.class); + Assertions.assertNotNull(result.getData()); + Assertions.assertNull(subResult.getArrayData()); + + // assert the property of null is not serialized at all + // certain backend (e.g. OpenAI) would fail the request, if found a "null" on the property + JsonNode jsonNode = new ObjectMapper().readTree(json.toStream()); + Assertions.assertFalse(jsonNode.has("arrayData")); + + // test non-null Union (optional property) + subResult = new SubResult("name", BinaryData.fromObject(BYTES)); + subResult.setArrayData(BinaryData.fromObject(Collections.singletonList("data1"))); + json = BinaryData.fromObject(subResult); + subResult = json.toObject(SubResult.class); + Assertions.assertNotNull(subResult.getArrayData()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/visibility/PropertyVisibilityTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/visibility/PropertyVisibilityTests.java new file mode 100644 index 0000000000..f28fb6cdfd --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/visibility/PropertyVisibilityTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.visibility; + +import com.azure.core.util.BinaryData; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.io.IOException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.visibility.models.RoundTripModel; + +public class PropertyVisibilityTests { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + @Test + public void testRoundTripSecret() throws IOException { + // serialization + RoundTripModel model = new RoundTripModel("john", "secret"); + BinaryData binaryData = BinaryData.fromObject(model); + JsonNode json = OBJECT_MAPPER.readTree(binaryData.toBytes()); + Assertions.assertEquals("secret", json.get("secretName").asText()); + + // de-serialization + ObjectNode objectNode = OBJECT_MAPPER.createObjectNode(); + objectNode.put("name", "john"); + byte[] jsonBytes = OBJECT_MAPPER.writeValueAsBytes(objectNode); + model = BinaryData.fromBytes(jsonBytes).toObject(RoundTripModel.class); + Assertions.assertEquals("john", model.getName()); + Assertions.assertNull(model.getSecretName()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/LocalModelTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/LocalModelTests.java new file mode 100644 index 0000000000..382ecc00dc --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/LocalModelTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.wiretype; + +import com.azure.core.util.BinaryData; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class LocalModelTests { + + @Test + public void testLocalModel() { + OffsetDateTime now = OffsetDateTime.now().withNano(0).withOffsetSameInstant(ZoneOffset.UTC); + + Model model = new Model(now); + BinaryData json = BinaryData.fromObject(model); + + Model model1 = json.toObject(Model.class); + Assertions.assertEquals(now, model1.getDateTimeRfc7231()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/Model.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/Model.java new file mode 100644 index 0000000000..4095c91724 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/Model.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.wiretype; + +import com.azure.core.util.DateTimeRfc1123; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +public final class Model { + + @JsonProperty(value = "dateTimeRfc7231") + private DateTimeRfc1123 dateTimeRfc7231; + + public Model(OffsetDateTime dateTimeRfc7231) { + this.dateTimeRfc7231 = new DateTimeRfc1123(dateTimeRfc7231); + } + + // Jackson fails with below error, if this private constructor not provided + // java.io.UncheckedIOException: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct + // instance of `com.cadl.wiretype.Model` (no Creators, like default constructor, exist): cannot deserialize from + // Object value (no delegate- or property-based Creator) + private Model() { + } + + // Alternatively, Jackson also fine with this private constructor. However, we seems do not really want this added + // complexity. +// @JsonCreator +// private Model(@JsonProperty(value = "dateTimeRfc7231") DateTimeRfc1123 dateTimeRfc7231) { +// this.dateTimeRfc7231 = dateTimeRfc7231; +// } + + public OffsetDateTime getDateTimeRfc7231() { + return this.dateTimeRfc7231.getDateTime(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/WireTypeTests.java b/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/WireTypeTests.java new file mode 100644 index 0000000000..7e9594354b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/tsptest/wiretype/WireTypeTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package tsptest.wiretype; + +import com.azure.core.util.BinaryData; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import tsptest.wiretype.models.SubClass; +import tsptest.wiretype.models.SubClassBothMismatch; +import tsptest.wiretype.models.SubClassMismatch; + +public class WireTypeTests { + + private static final OffsetDateTime NOW = OffsetDateTime.now().withNano(0).withOffsetSameInstant(ZoneOffset.UTC); + private static final byte[] BYTES = "test".getBytes(StandardCharsets.UTF_8); + + @Test + public void testSuperClassMismatch() { + SubClass model = new SubClass(NOW, NOW); + + BinaryData json = BinaryData.fromObject(model); + SubClass model1 = json.toObject(SubClass.class); + + Assertions.assertEquals(NOW, model1.getDateTime()); + Assertions.assertEquals(NOW, model1.getDateTimeRfc7231()); + } + + @Test + public void testSubClassMismatch() { + SubClassMismatch model = new SubClassMismatch(NOW, NOW); + + BinaryData json = BinaryData.fromObject(model); + SubClassMismatch model1 = json.toObject(SubClassMismatch.class); + + Assertions.assertEquals(NOW, model1.getDateTime()); + Assertions.assertEquals(NOW, model1.getDateTimeRfc7231()); + } + + @Test + public void testBothClassMismatch() { + SubClassBothMismatch model = new SubClassBothMismatch(NOW, BYTES); + + BinaryData json = BinaryData.fromObject(model); + SubClassBothMismatch model1 = json.toObject(SubClassBothMismatch.class); + + Assertions.assertArrayEquals(BYTES, model1.getBase64url()); + Assertions.assertEquals(NOW, model1.getDateTimeRfc7231()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/BooleanValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/BooleanValueClientTest.java new file mode 100644 index 0000000000..0e24fb51bb --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/BooleanValueClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class BooleanValueClientTest { + + BooleanValueClient client = new ArrayClientBuilder().buildBooleanValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(2, response.size()); + Assertions.assertEquals(true, response.get(0)); + Assertions.assertEquals(false, response.get(1)); + } + + @Test + void put() { + List body = Arrays.asList(true, false); + client.put(body); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/DatetimeValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/DatetimeValueClientTest.java new file mode 100644 index 0000000000..3078fe232f --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/DatetimeValueClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class DatetimeValueClientTest { + + DatetimeValueClient client = new ArrayClientBuilder().buildDatetimeValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(1, response.size()); + Assertions.assertEquals(OffsetDateTime.parse("2022-08-26T18:38:00Z"), response.get(0)); + } + + @Test + void put() { + List body = Arrays.asList(OffsetDateTime.parse("2022-08-26T18:38:00Z")); + client.put(body); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/DurationValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/DurationValueClientTest.java new file mode 100644 index 0000000000..d5e417f0ce --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/DurationValueClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.time.Duration; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class DurationValueClientTest { + + DurationValueClient client = new ArrayClientBuilder().buildDurationValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(1, response.size()); + Assertions.assertEquals(Duration.parse("P123DT22H14M12.011S"), response.get(0)); + } + + @Test + void put() { + Duration duration = Duration.parse("P123DT22H14M12.011S"); + client.put(Arrays.asList(duration)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/Float32ValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/Float32ValueClientTest.java new file mode 100644 index 0000000000..ca526e17bf --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/Float32ValueClientTest.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class Float32ValueClientTest { + + Float32ValueClient client = new ArrayClientBuilder().buildFloat32ValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(1, response.size()); + Assertions.assertEquals(43.125, response.get(0)); + } + + @Test + void put() { + client.put(Arrays.asList(43.125)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/Int32ValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/Int32ValueClientTest.java new file mode 100644 index 0000000000..1f12586a50 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/Int32ValueClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class Int32ValueClientTest { + + Int32ValueClient client = new ArrayClientBuilder().buildInt32ValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(2, response.size()); + Assertions.assertEquals(1, response.get(0)); + Assertions.assertEquals(2, response.get(1)); + + } + + @Test + void put() { + client.put(Arrays.asList(1, 2)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/Int64ValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/Int64ValueClientTest.java new file mode 100644 index 0000000000..9ff408f452 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/Int64ValueClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class Int64ValueClientTest { + + Int64ValueClient client = new ArrayClientBuilder().buildInt64ValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(2, response.size()); + Assertions.assertEquals(9007199254740991L, response.get(0)); + Assertions.assertEquals(-9007199254740991L, response.get(1)); + } + + @Test + void put() { + client.put(Arrays.asList(9007199254740991L, -9007199254740991L)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/ModelValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/ModelValueClientTest.java new file mode 100644 index 0000000000..5d87cb0586 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/ModelValueClientTest.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.array.models.InnerModel; + +class ModelValueClientTest { + + ModelValueClient client = new ArrayClientBuilder().buildModelValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(2, response.size()); + Assertions.assertEquals("hello", response.get(0).getProperty()); + Assertions.assertEquals("world", response.get(1).getProperty()); + } + + @Test + void put() { + InnerModel model1 = new InnerModel("hello"); + InnerModel model2 = new InnerModel("world"); + client.put(Arrays.asList(model1, model2)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableBooleanValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableBooleanValueClientTest.java new file mode 100644 index 0000000000..c1ce9541c4 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableBooleanValueClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import static org.junit.jupiter.api.Assertions.assertIterableEquals; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class NullableBooleanValueClientTest { + + private final NullableBooleanValueClient client = new ArrayClientBuilder().buildNullableBooleanValueClient(); + + @Test + public void get() { + List response = client.get(); + assertIterableEquals(Arrays.asList(true, null, false), response); + } + + @Test + public void put() { + List body = Arrays.asList(true, null, false); + client.put(body); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableFloatValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableFloatValueClientTest.java new file mode 100644 index 0000000000..ebd920a600 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableFloatValueClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +class NullableFloatValueClientTest { + + NullableFloatValueClient client = new ArrayClientBuilder().buildNullableFloatValueClient(); + + @Test + void get() { + List response = client.get(); + assertEquals(Arrays.asList(1.25, null, 3.0), response); + } + + @Test + void put() { + List body = Arrays.asList(1.25, null, 3.0); + client.put(body); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableInt32ValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableInt32ValueClientTest.java new file mode 100644 index 0000000000..9368ea2db3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableInt32ValueClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import static org.junit.jupiter.api.Assertions.assertIterableEquals; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class NullableInt32ValueClientTest { + + private final NullableInt32ValueClient client = new ArrayClientBuilder().buildNullableInt32ValueClient(); + + @Test + public void get() { + List response = client.get(); + assertIterableEquals(Arrays.asList(1, null, 3), response); + } + + @Test + public void put() { + List body = Arrays.asList(1, null, 3); + client.put(body); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableModelValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableModelValueClientTest.java new file mode 100644 index 0000000000..d11e6cb736 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableModelValueClientTest.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.array.models.InnerModel; + +public class NullableModelValueClientTest { + + private final NullableModelValueClient client = new ArrayClientBuilder().buildNullableModelValueClient(); + + @Test + public void get() { + List response = client.get(); + assertEquals(3, response.size()); + assertEquals("hello", response.get(0).getProperty()); + Assertions.assertNull(response.get(1)); + assertEquals("world", response.get(2).getProperty()); + } + + @Test + public void put() { + List body = Arrays.asList(new InnerModel("hello"), null, new InnerModel("world")); + client.put(body); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableStringValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableStringValueClientTest.java new file mode 100644 index 0000000000..fb7a139687 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/NullableStringValueClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import static org.junit.jupiter.api.Assertions.assertIterableEquals; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Test; + +public class NullableStringValueClientTest { + + private final NullableStringValueClient client = new ArrayClientBuilder().buildNullableStringValueClient(); + + @Test + public void get() { + List response = client.get(); + assertIterableEquals(Arrays.asList("hello", null, "world"), response); + } + + @Test + public void put() { + List body = Arrays.asList("hello", null, "world"); + client.put(body); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/StringValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/StringValueClientTest.java new file mode 100644 index 0000000000..0dd68797d2 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/StringValueClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class StringValueClientTest { + + StringValueClient client = new ArrayClientBuilder().buildStringValueClient(); + + @Test + void get() { + List response = client.get(); + Assertions.assertEquals(2, response.size()); + Assertions.assertEquals("hello", response.get(0)); + Assertions.assertEquals("", response.get(1)); + } + + @Test + void put() { + client.put(Arrays.asList("hello", "")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/array/UnknownValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/array/UnknownValueClientTest.java new file mode 100644 index 0000000000..f556aff68b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/array/UnknownValueClientTest.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.array; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class UnknownValueClientTest { + + private final UnknownValueClient client = new ArrayClientBuilder().buildUnknownValueClient(); + + // BinaryData case, when use-object-for-unknown=false +// @Disabled("TODO https://github.com/Azure/autorest.java/issues/2964") +// @Test +// public void get() { +// List response = client.get(); +// Assertions.assertEquals(3, response.size()); +// Assertions.assertEquals(1, response.get(0).toObject(Integer.class)); +// Assertions.assertEquals("hello", response.get(1).toObject(String.class)); +// Assertions.assertEquals(null, response.get(2)); +// } +// +// @Test +// public void put() { +// client.put(Arrays.asList( +// BinaryData.fromObject(1), +// BinaryData.fromObject("hello"), null)); +// } + + @Test + public void get() { + List response = client.get(); + Assertions.assertEquals(3, response.size()); + Assertions.assertEquals(1, response.get(0)); + Assertions.assertEquals("hello", response.get(1)); + Assertions.assertEquals(null, response.get(2)); + } + + @Test + public void put() { + client.put(Arrays.asList(1, "hello", null)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/BooleanValueTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/BooleanValueTests.java new file mode 100644 index 0000000000..bc024b7b83 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/BooleanValueTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class BooleanValueTests { + + private final BooleanValueClient client = new DictionaryClientBuilder().buildBooleanValueClient(); + private final Map expected = new HashMap<>(); + { + expected.put("k1", true); + expected.put("k2", false); + } + + @Test + public void testBooleanGet() { + Map response = client.get(); + Assertions.assertEquals(expected, response); + } + + @Test + public void testBooleanPut() { + client.put(expected); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/DatetimeValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/DatetimeValueClientTest.java new file mode 100644 index 0000000000..876ecc9919 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/DatetimeValueClientTest.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class DatetimeValueClientTest { + + DatetimeValueClient client = new DictionaryClientBuilder().buildDatetimeValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertTrue(response.containsKey("k1")); + Assertions.assertEquals(OffsetDateTime.parse("2022-08-26T18:38Z"), response.get("k1")); + } + + @Test + void put() { + Map map = new HashMap<>(); + map.put("k1", OffsetDateTime.parse("2022-08-26T18:38Z")); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/DurationValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/DurationValueClientTest.java new file mode 100644 index 0000000000..408ddab472 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/DurationValueClientTest.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.time.Duration; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class DurationValueClientTest { + + DurationValueClient client = new DictionaryClientBuilder().buildDurationValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertTrue(response.containsKey("k1")); + Assertions.assertEquals(Duration.parse("P123DT22H14M12.011S"), response.get("k1")); + } + + @Test + void put() { + Map map = new HashMap<>(); + map.put("k1", Duration.parse("P123DT22H14M12.011S")); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Float32ValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Float32ValueClientTest.java new file mode 100644 index 0000000000..8dd069f551 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Float32ValueClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class Float32ValueClientTest { + + Float32ValueClient client = new DictionaryClientBuilder().buildFloat32ValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertTrue(response.containsKey("k1")); + Assertions.assertEquals(43.125, response.get("k1")); + } + + @Test + void put() { + Map map = new HashMap<>(); + map.put("k1", 43.125); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Int32ValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Int32ValueClientTest.java new file mode 100644 index 0000000000..6e000c4f10 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Int32ValueClientTest.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class Int32ValueClientTest { + + Int32ValueClient client = new DictionaryClientBuilder().buildInt32ValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertTrue(response.containsKey("k1")); + Assertions.assertEquals(1, response.get("k1")); + Assertions.assertTrue(response.containsKey("k2")); + Assertions.assertEquals(2, response.get("k2")); + } + + @Test + void put() { + Map map = new HashMap<>(); + map.put("k1", 1); + map.put("k2", 2); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Int64ValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Int64ValueClientTest.java new file mode 100644 index 0000000000..dc1281daff --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/Int64ValueClientTest.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class Int64ValueClientTest { + + Int64ValueClient client = new DictionaryClientBuilder().buildInt64ValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertTrue(response.containsKey("k1")); + Assertions.assertEquals(9007199254740991L, response.get("k1")); + Assertions.assertTrue(response.containsKey("k2")); + Assertions.assertEquals(-9007199254740991L, response.get("k2")); + } + + @Test + void put() { + Map map = new HashMap<>(); + map.put("k1", 9007199254740991L); + map.put("k2", -9007199254740991L); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/ModelValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/ModelValueClientTest.java new file mode 100644 index 0000000000..9bdc616cee --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/ModelValueClientTest.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.dictionary.models.InnerModel; + +class ModelValueClientTest { + + ModelValueClient client = new DictionaryClientBuilder().buildModelValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertTrue(response.containsKey("k1")); + InnerModel innerModel1 = response.get("k1"); + Assertions.assertEquals("hello", innerModel1.getProperty()); + Assertions.assertEquals(null, innerModel1.getChildren()); + + Assertions.assertTrue(response.containsKey("k2")); + InnerModel innerModel2 = response.get("k2"); + Assertions.assertEquals(null, innerModel2.getChildren()); + + } + + @Test + void put() { + Map map = new HashMap<>(); + InnerModel innerModel1 = new InnerModel("hello"); + map.put("k1", innerModel1); + InnerModel innerModel2 = new InnerModel("world"); + map.put("k2", innerModel2); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/NullableFloatValueClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/NullableFloatValueClientTests.java new file mode 100644 index 0000000000..f8da6544ee --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/NullableFloatValueClientTests.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import com.azure.core.util.BinaryData; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class NullableFloatValueClientTests { + + private final static ObjectMapper MAPPER = new ObjectMapper(); + + private final NullableFloatValueClient client = new DictionaryClientBuilder().buildNullableFloatValueClient(); + + @Test + public void get() { + + Map result = client.get(); + + Assertions.assertTrue(result.containsKey("k3")); + Assertions.assertNull(result.get("k3")); + } + + @Test + public void put() throws Exception { + MapModel model = new MapModel(); + model.map = new HashMap<>(); + model.map.put("k1", 1.25); + model.map.put("k2", 0.5); + model.map.put("k3", null); + + // Map as request does not work + // Model contains Map works, if "@JsonInclude(value = JsonInclude.Include.NON_NULL)" on that Map + // see tsp/builtin.tsp and its generated code + BinaryData requestAsModel = BinaryData.fromObject(model); + JsonNode node = MAPPER.readTree(requestAsModel.toString()).get("map"); + BinaryData request = BinaryData.fromObject(node); + + client.putWithResponse(request, null); + } + + public static class MapModel { + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + Map map; + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/RecursiveModelValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/RecursiveModelValueClientTest.java new file mode 100644 index 0000000000..d89e26978c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/RecursiveModelValueClientTest.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.dictionary.models.InnerModel; + +class RecursiveModelValueClientTest { + + RecursiveModelValueClient client = new DictionaryClientBuilder().buildRecursiveModelValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertTrue(response.containsKey("k1")); + InnerModel innerModel1 = response.get("k1"); + Assertions.assertEquals("hello", innerModel1.getProperty()); + Assertions.assertEquals(new HashMap<>(), innerModel1.getChildren()); + + Assertions.assertTrue(response.containsKey("k2")); + InnerModel innerModel2 = response.get("k2"); + Assertions.assertEquals("world", innerModel2.getProperty()); + Assertions.assertEquals("inner world", innerModel2.getChildren().get("k2.1").getProperty()); + } + + @Test + void put() { + Map map = new HashMap<>(); + InnerModel innerModel1 = new InnerModel("hello"); + innerModel1.setChildren(new HashMap<>()); + map.put("k1", innerModel1); + InnerModel innerModel2 = new InnerModel("world"); + Map children = new HashMap<>(); + children.put("k2.1", new InnerModel("inner world")); + innerModel2.setChildren(children); + map.put("k2", innerModel2); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/StringValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/StringValueClientTest.java new file mode 100644 index 0000000000..6462c1d0a3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/StringValueClientTest.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +class StringValueClientTest { + + StringValueClient client = new DictionaryClientBuilder().buildStringValueClient(); + + @Test + void get() { + Map response = client.get(); + Assertions.assertEquals("hello", response.get("k1")); + Assertions.assertEquals("", response.get("k2")); + } + + @Test + void put() { + Map map = new HashMap<>(); + map.put("k1", "hello"); + map.put("k2", ""); + client.put(map); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/UnknownValueClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/UnknownValueClientTest.java new file mode 100644 index 0000000000..f02f691222 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/dictionary/UnknownValueClientTest.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.dictionary; + +import com.azure.core.util.BinaryData; +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.NullNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class UnknownValueClientTest { + + public final UnknownValueClient client = new DictionaryClientBuilder().buildUnknownValueClient(); + + // BinaryData case, when use-object-for-unknown=false +// @Disabled("TODO https://github.com/Azure/autorest.java/issues/2964") +// @Test +// public void get() { +// Map response = client.get(); +// Assertions.assertEquals(1, response.get("k1").toObject(Integer.class)); +// Assertions.assertEquals("hello", response.get("k2").toObject(String.class)); +// Assertions.assertEquals(null, response.get("k3")); +// } +// +// @Test +// public void putWithResponse() { +// ObjectNode map = JsonNodeFactory.instance.objectNode(); +// map.put("k1", 1); +// map.put("k2", "hello"); +// map.set("k3", NullNode.instance); +// client.putWithResponse(BinaryData.fromObject(map), null); +// } + + @Test + public void get() { + Map response = client.get(); + Assertions.assertEquals(1, response.get("k1")); + Assertions.assertEquals("hello", response.get("k2")); + Assertions.assertEquals(null, response.get("k3")); + } + + @Test + public void putWithResponse() { + ObjectNode map = JsonNodeFactory.instance.objectNode(); + map.put("k1", 1); + map.put("k2", "hello"); + map.set("k3", NullNode.instance); + client.putWithResponse(BinaryData.fromObject(map), null); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/enums/extensible/ExtensibleClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/enums/extensible/ExtensibleClientTest.java new file mode 100644 index 0000000000..a3d87e2359 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/enums/extensible/ExtensibleClientTest.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.enums.extensible; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.enums.extensible.models.DaysOfWeekExtensibleEnum; + +class ExtensibleClientTest { + + ExtensibleClient client = new ExtensibleClientBuilder().buildClient(); + + @Test + void getKnownValue() { + DaysOfWeekExtensibleEnum daysOfWeekExtensibleEnum = client.getKnownValue(); + Assertions.assertEquals(DaysOfWeekExtensibleEnum.MONDAY, daysOfWeekExtensibleEnum); + } + + @Test + void getUnknownValue() { + DaysOfWeekExtensibleEnum daysOfWeekExtensibleEnum = client.getUnknownValue(); + Assertions.assertEquals("Weekend", daysOfWeekExtensibleEnum.toString()); + } + + @Test + void putKnownValue() { + DaysOfWeekExtensibleEnum daysOfWeekExtensibleEnum = DaysOfWeekExtensibleEnum.MONDAY; + client.putKnownValue(daysOfWeekExtensibleEnum); + } + + @Test + void putUnknownValue() { + DaysOfWeekExtensibleEnum daysOfWeekExtensibleEnum = DaysOfWeekExtensibleEnum.fromString("Weekend"); + client.putUnknownValue(daysOfWeekExtensibleEnum); + } + +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/enums/fixed/FixedClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/enums/fixed/FixedClientTest.java new file mode 100644 index 0000000000..b936191155 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/enums/fixed/FixedClientTest.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.enums.fixed; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.policy.FixedDelayOptions; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.util.BinaryData; +import java.time.Duration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.enums.fixed.models.DaysOfWeekEnum; + +class FixedClientTest { + + FixedClient client + = new FixedClientBuilder().retryOptions(new RetryOptions(new FixedDelayOptions(0, Duration.ZERO))) + .buildClient(); + + @Test + void getKnownValue() { + DaysOfWeekEnum daysOfWeekEnum = client.getKnownValue(); + Assertions.assertEquals(DaysOfWeekEnum.MONDAY, daysOfWeekEnum); + } + + @Test + void putKnownValue() { + client.putKnownValue(DaysOfWeekEnum.MONDAY); + } + + @Test + void putUnknownValue() { + // Not a valid test for Java, as compiler will fail at "DaysOfWeekEnum.WEEKEND" + // client.putUnknownValue(DaysOfWeekEnum.WEEKEND); + + Assertions.assertThrowsExactly(HttpResponseException.class, + () -> client.putUnknownValueWithResponse(BinaryData.fromObject("Weekend"), null)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/file/FileTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/file/FileTests.java new file mode 100644 index 0000000000..b6d45c6683 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/file/FileTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.file; + +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.rest.RequestOptions; +import com.azure.core.util.BinaryData; +import java.nio.file.Path; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.FileUtils; + +public class FileTests { + + private static final Path PNG_FILE = FileUtils.getPngFile(); + + private final FileClient client = new FileClientBuilder().buildClient(); + + @Test + public void testUploadFileSpecificContentType() { + client.uploadFileSpecificContentType(BinaryData.fromFile(PNG_FILE)); + } + + @Test + public void testUploadFileJsonContentType() { + // For JSON content type, we need to send a JSON payload + BinaryData jsonData = BinaryData.fromString("{\"message\":\"test file content\"}"); + client.uploadFileJsonContentType(jsonData); + } + + @Test + public void testDownloadFileJsonContentType() { + BinaryData response = client.downloadFileJsonContentType(); + Assertions.assertNotNull(response); + } + + @Test + public void testDownloadFileSpecificContentType() { + BinaryData response = client.downloadFileSpecificContentType(); + Assertions.assertNotNull(response); + } + + @Test + public void testUploadFileMultipleContentTypes() { + client.uploadFileMultipleContentTypesWithResponse("image/png", BinaryData.fromFile(PNG_FILE), null); + } + + @Test + public void testDownloadFileMultipleContentTypes() { + BinaryData response = client.downloadFileMultipleContentTypes(); + Assertions.assertNotNull(response); + } + + @Test + public void testUploadFileDefaultContentType() { + client.uploadFileDefaultContentTypeWithResponse(BinaryData.fromFile(PNG_FILE), + new RequestOptions().setHeader(HttpHeaderName.CONTENT_TYPE, "image/png")); + } + + @Test + public void testDownloadFileDefaultContentType() { + BinaryData response = client.downloadFileDefaultContentType(); + Assertions.assertNotNull(response); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/empty/EmptyModelTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/empty/EmptyModelTests.java new file mode 100644 index 0000000000..56cd984cef --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/empty/EmptyModelTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.empty; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.empty.models.EmptyInput; +import type.model.empty.models.EmptyInputOutput; +import type.model.empty.models.EmptyOutput; + +public class EmptyModelTests { + + private final EmptyClient client = new EmptyClientBuilder().buildClient(); + + @Test + public void testEmptyModel() { + EmptyOutput output = client.getEmpty(); + Assertions.assertNotNull(output); + + client.putEmpty(new EmptyInput()); + + EmptyInputOutput inputOutput = client.postRoundTripEmpty(new EmptyInputOutput()); + Assertions.assertNotNull(inputOutput); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/EnumDiscriminatorTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/EnumDiscriminatorTests.java new file mode 100644 index 0000000000..9c9dc0224b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/EnumDiscriminatorTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.inheritance; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.inheritance.enumdiscriminator.EnumDiscriminatorClient; +import type.model.inheritance.enumdiscriminator.EnumDiscriminatorClientBuilder; +import type.model.inheritance.enumdiscriminator.models.Cobra; +import type.model.inheritance.enumdiscriminator.models.Dog; +import type.model.inheritance.enumdiscriminator.models.Golden; +import type.model.inheritance.enumdiscriminator.models.Snake; + +public class EnumDiscriminatorTests { + + private final EnumDiscriminatorClient client = new EnumDiscriminatorClientBuilder().buildClient(); + + @Test + public void testEnumDiscriminator() { + Snake fixedModel = client.getFixedModel(); + Assertions.assertEquals(Cobra.class, fixedModel.getClass()); + client.putFixedModel(fixedModel); + + Dog extensibleModel = client.getExtensibleModel(); + Assertions.assertEquals(Golden.class, extensibleModel.getClass()); + client.putExtensibleModel(extensibleModel); + + client.getFixedModelMissingDiscriminator(); + client.getFixedModelWrongDiscriminator(); + + client.getExtensibleModelMissingDiscriminator(); + client.getExtensibleModelWrongDiscriminator(); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/InheritanceTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/InheritanceTests.java new file mode 100644 index 0000000000..6708b9c453 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/InheritanceTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.inheritance; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.inheritance.notdiscriminated.NotDiscriminatedClient; +import type.model.inheritance.notdiscriminated.NotDiscriminatedClientBuilder; +import type.model.inheritance.notdiscriminated.models.Siamese; + +class InheritanceTests { + + NotDiscriminatedClient client = new NotDiscriminatedClientBuilder().buildClient(); + + @Test + void postValid() { + Siamese siamese = new Siamese("abc", 32, true); + client.postValid(siamese); + } + + @Test + void getValid() { + Siamese siamese = client.getValid(); + Assertions.assertEquals(true, siamese.isSmart()); + Assertions.assertEquals(32, siamese.getAge()); + Assertions.assertEquals("abc", siamese.getName()); + } + + @Test + void putValid() { + Siamese siamese = new Siamese("abc", 32, true); + client.putValid(siamese); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/NestedDiscriminatorTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/NestedDiscriminatorTests.java new file mode 100644 index 0000000000..148e7c1e7b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/NestedDiscriminatorTests.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.inheritance; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClient; +import type.model.inheritance.nesteddiscriminator.NestedDiscriminatorClientBuilder; +import type.model.inheritance.nesteddiscriminator.models.Fish; +import type.model.inheritance.nesteddiscriminator.models.GoblinShark; +import type.model.inheritance.nesteddiscriminator.models.Salmon; +import type.model.inheritance.nesteddiscriminator.models.SawShark; +import type.model.inheritance.nesteddiscriminator.models.Shark; + +class NestedDiscriminatorTests { + + NestedDiscriminatorClient client = new NestedDiscriminatorClientBuilder().buildClient(); + + @Test + void getModel() { + Fish fish = client.getModel(); + Assertions.assertEquals(1, fish.getAge()); + } + + @Test + void putModel() { + Shark body = new GoblinShark(1); + client.putModel(body); + } + + @Test + void getRecursiveModel() { + Salmon salmon = (Salmon) client.getRecursiveModel(); + Assertions.assertEquals(2, salmon.getFriends().size()); + Assertions.assertEquals(2, salmon.getHate().size()); + Assertions.assertEquals(SawShark.class, salmon.getPartner().getClass()); + Assertions.assertEquals(1, salmon.getAge()); + Assertions.assertEquals(2, (salmon.getPartner()).getAge()); + } + + @Test + void putRecursiveModel() { + Salmon salmon = new Salmon(1); + salmon.setPartner(new SawShark(2)); + + List friends = new ArrayList<>(); + Salmon friend1 = new Salmon(2); + friend1.setPartner(new Salmon(3)); + Map friend1Hate = new LinkedHashMap<>(); + friend1Hate.put("key1", new Salmon(4)); + friend1Hate.put("key2", new GoblinShark(2)); + friend1.setHate(friend1Hate); + friends.add(friend1); + + Shark friend2 = new GoblinShark(3); + friends.add(friend2); + salmon.setFriends(friends); + + Map salmonHate = new LinkedHashMap<>(); + salmonHate.put("key3", new SawShark(3)); + List salmonHateFriends = new ArrayList<>(); + salmonHateFriends.add(new Salmon(1)); + salmonHateFriends.add(new GoblinShark(4)); + salmonHate.put("key4", new Salmon(2).setFriends(salmonHateFriends)); + salmon.setHate(salmonHate); + + client.putRecursiveModel(salmon); + } + + @Test + void getMissingDiscriminator() { + Fish fish = client.getMissingDiscriminator(); + Assertions.assertEquals(1, fish.getAge()); + } + + @Test + void getWrongDiscriminator() { + Fish fish = client.getWrongDiscriminator(); + Assertions.assertEquals(1, fish.getAge()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/RecursiveReferenceTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/RecursiveReferenceTests.java new file mode 100644 index 0000000000..555c841426 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/RecursiveReferenceTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.inheritance; + +import org.junit.jupiter.api.Test; +import type.model.inheritance.recursive.RecursiveClient; +import type.model.inheritance.recursive.RecursiveClientBuilder; +import type.model.inheritance.recursive.models.Extension; + +public class RecursiveReferenceTests { + + private final RecursiveClient client = new RecursiveClientBuilder().buildClient(); + + @Test + public void test() { + Extension extension = client.get(); + client.put(extension); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/SingleDiscriminatorTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/SingleDiscriminatorTest.java new file mode 100644 index 0000000000..552b422733 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/inheritance/SingleDiscriminatorTest.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.inheritance; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.inheritance.singlediscriminator.SingleDiscriminatorClient; +import type.model.inheritance.singlediscriminator.SingleDiscriminatorClientBuilder; +import type.model.inheritance.singlediscriminator.models.Bird; +import type.model.inheritance.singlediscriminator.models.Eagle; +import type.model.inheritance.singlediscriminator.models.Fish; +import type.model.inheritance.singlediscriminator.models.Goose; +import type.model.inheritance.singlediscriminator.models.SeaGull; +import type.model.inheritance.singlediscriminator.models.Sparrow; +import type.model.inheritance.singlediscriminator.models.TRex; + +public class SingleDiscriminatorTest { + + private final SingleDiscriminatorClient client = new SingleDiscriminatorClientBuilder().buildClient(); + + @Test + public void testSingleDiscriminator() { + Assertions.assertEquals(TRex.class, client.getLegacyModel().getClass()); + + client.getMissingDiscriminator(); + client.getWrongDiscriminator(); + + Bird model = client.getModel(); + Assertions.assertEquals(Sparrow.class, model.getClass()); + client.putModel(model); + + Eagle recursiveModel = (Eagle) client.getRecursiveModel(); + Assertions.assertEquals(Eagle.class, recursiveModel.getClass()); + Assertions.assertEquals(Goose.class, recursiveModel.getPartner().getClass()); + Assertions.assertEquals(SeaGull.class, recursiveModel.getFriends().get(0).getClass()); + Assertions.assertEquals(Sparrow.class, recursiveModel.getHate().get("key3").getClass()); + client.putRecursiveModel(recursiveModel); + } + + @Test + public void testNoSubtypesModel() { + Fish fish = client.getNoSubtypesModel(); + Assertions.assertNotNull(fish); + Assertions.assertEquals(10, fish.getSize()); + + client.putNoSubtypesModel(fish); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/usage/ModelsUsageClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/usage/ModelsUsageClientTest.java new file mode 100644 index 0000000000..fc23ad5c5c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/usage/ModelsUsageClientTest.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.usage; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.usage.models.InputOutputRecord; +import type.model.usage.models.InputRecord; +import type.model.usage.models.OutputRecord; + +class ModelsUsageClientTest { + + UsageClient client = new UsageClientBuilder().buildClient(); + + @Test + void input() { + InputRecord inputRecord = new InputRecord("example-value"); + client.input(inputRecord); + } + + @Test + void output() { + OutputRecord outputRecord = client.output(); + Assertions.assertEquals("example-value", outputRecord.getRequiredProp()); + } + + @Test + void inputAndOutput() { + InputOutputRecord inputOutputRecord = new InputOutputRecord("example-value"); + InputOutputRecord response = client.inputAndOutput(inputOutputRecord); + Assertions.assertEquals("example-value", response.getRequiredProp()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/usage/UsageClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/usage/UsageClientTest.java new file mode 100644 index 0000000000..a1042ba9ed --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/usage/UsageClientTest.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.usage; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.usage.models.InputOutputRecord; +import type.model.usage.models.InputRecord; +import type.model.usage.models.OutputRecord; + +class UsageClientTest { + + UsageClient client = new UsageClientBuilder().buildClient(); + + @Test + void input() { + InputRecord inputRecord = new InputRecord("example-value"); + client.input(inputRecord); + } + + @Test + void output() { + OutputRecord outputRecord = client.output(); + Assertions.assertEquals("example-value", outputRecord.getRequiredProp()); + } + + @Test + void inputAndOutput() { + InputOutputRecord inputOutputRecord = new InputOutputRecord("example-value"); + InputOutputRecord response = client.inputAndOutput(inputOutputRecord); + Assertions.assertEquals("example-value", response.getRequiredProp()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/model/visibility/AutomaticClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/model/visibility/AutomaticClientTest.java new file mode 100644 index 0000000000..bcfe92cf19 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/model/visibility/AutomaticClientTest.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.model.visibility; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.netty.NettyAsyncHttpClientProvider; +import com.azure.core.util.HttpClientOptions; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.model.visibility.models.ReadOnlyModel; +import type.model.visibility.models.VisibilityModel; + +class AutomaticClientTest { + + private final VisibilityClient client = new VisibilityClientBuilder() + .httpClient( + HttpClient.createDefault(new HttpClientOptions().setHttpClientProvider(NettyAsyncHttpClientProvider.class))) + .buildClient(); + + @Test + void getModel() { + // client.getModelWithResponse(BinaryData.fromString("{\"queryProp\": 123}"), null); + client.getModel(123, new VisibilityModel(null, null, null)); + } + + @Test + void headModel() { + // client.headModelWithResponse(BinaryData.fromString("{\"queryProp\": 123}"), null); + client.headModel(123, new VisibilityModel(null, null, null)); + } + + @Test + void putModel() { + client.putModel(new VisibilityModel(Arrays.asList("foo", "bar"), Arrays.asList(1, 2), null)); + } + + @Test + void patchModel() { + client.patchModel(new VisibilityModel(null, Arrays.asList(1, 2), null)); + } + + @Test + void postModel() { + client.postModel(new VisibilityModel(Arrays.asList("foo", "bar"), null, null)); + } + + @Test + void deleteModel() { + client.deleteModel(new VisibilityModel(null, null, true)); + } + + @Test + void putReadOnlyModel() { + ReadOnlyModel readOnlyModel = client.putReadOnlyModel(new ReadOnlyModel()); + Assertions.assertIterableEquals(Arrays.asList(1, 2, 3), readOnlyModel.getOptionalNullableIntList()); + Assertions.assertEquals("value1", readOnlyModel.getOptionalStringRecord().get("k1")); + Assertions.assertEquals("value2", readOnlyModel.getOptionalStringRecord().get("k2")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/ExtendsTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/ExtendsTests.java new file mode 100644 index 0000000000..708519c489 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/ExtendsTests.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import com.azure.core.util.BinaryData; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.BinaryDataUtils; +import type.property.additionalproperties.models.DifferentSpreadFloatDerived; +import type.property.additionalproperties.models.DifferentSpreadModelArrayDerived; +import type.property.additionalproperties.models.DifferentSpreadModelDerived; +import type.property.additionalproperties.models.DifferentSpreadStringDerived; +import type.property.additionalproperties.models.ExtendsFloatAdditionalProperties; +import type.property.additionalproperties.models.ExtendsModelAdditionalProperties; +import type.property.additionalproperties.models.ExtendsModelArrayAdditionalProperties; +import type.property.additionalproperties.models.ExtendsStringAdditionalProperties; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalProperties; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDerived; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminated; +import type.property.additionalproperties.models.ExtendsUnknownAdditionalPropertiesDiscriminatedDerived; +import type.property.additionalproperties.models.ModelForRecord; + +public class ExtendsTests { + private final ExtendsFloatClient extendsFloatClient + = new AdditionalPropertiesClientBuilder().buildExtendsFloatClient(); + private final ExtendsModelArrayClient extendsModelArrayClient + = new AdditionalPropertiesClientBuilder().buildExtendsModelArrayClient(); + private final ExtendsModelClient extendsModelClient + = new AdditionalPropertiesClientBuilder().buildExtendsModelClient(); + private final ExtendsStringClient extendsStringClient + = new AdditionalPropertiesClientBuilder().buildExtendsStringClient(); + private final ExtendsUnknownClient extendsUnknownClient + = new AdditionalPropertiesClientBuilder().buildExtendsUnknownClient(); + private final ExtendsUnknownDerivedClient extendsUnknownDerivedClient + = new AdditionalPropertiesClientBuilder().buildExtendsUnknownDerivedClient(); + private final ExtendsUnknownDiscriminatedClient extendsUnknownDiscriminatedClient + = new AdditionalPropertiesClientBuilder().buildExtendsUnknownDiscriminatedClient(); + private final ExtendsDifferentSpreadStringClient extendsDifferentSpreadStringClient + = new AdditionalPropertiesClientBuilder().buildExtendsDifferentSpreadStringClient(); + private final ExtendsDifferentSpreadFloatClient extendsDifferentSpreadFloatClient + = new AdditionalPropertiesClientBuilder().buildExtendsDifferentSpreadFloatClient(); + private final ExtendsDifferentSpreadModelClient extendsDifferentSpreadModelClient + = new AdditionalPropertiesClientBuilder().buildExtendsDifferentSpreadModelClient(); + private final ExtendsDifferentSpreadModelArrayClient extendsDifferentSpreadModelArrayClient + = new AdditionalPropertiesClientBuilder().buildExtendsDifferentSpreadModelArrayClient(); + + @Test + public void testExtendsFloat() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", 43.125); + ExtendsFloatAdditionalProperties body = new ExtendsFloatAdditionalProperties(43.125); + body.setAdditionalProperties(propertyMap); + extendsFloatClient.put(body); + + ExtendsFloatAdditionalProperties properties = extendsFloatClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals(43.125, properties.getId()); + Assertions.assertIterableEquals(propertyMap.entrySet(), properties.getAdditionalProperties().entrySet()); + } + + @Test + public void testExtendsModelArrayClient() { + Map> propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + ExtendsModelArrayAdditionalProperties body = new ExtendsModelArrayAdditionalProperties( + Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + body.setAdditionalProperties(propertyMap); + extendsModelArrayClient.put(body); + + ExtendsModelArrayAdditionalProperties properties = extendsModelArrayClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getKnownProp()); + properties.getKnownProp().forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertNotNull(properties.getAdditionalProperties().get("prop")); + properties.getAdditionalProperties() + .get("prop") + .forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + } + + @Test + public void testExtendsModelClient() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", new ModelForRecord("ok")); + ExtendsModelAdditionalProperties body = new ExtendsModelAdditionalProperties(new ModelForRecord("ok")); + body.setAdditionalProperties(propertyMap); + extendsModelClient.put(body); + + ExtendsModelAdditionalProperties properties = extendsModelClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getKnownProp()); + Assertions.assertEquals("ok", properties.getKnownProp().getState()); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertNotNull(properties.getAdditionalProperties().get("prop")); + Assertions.assertEquals("ok", properties.getAdditionalProperties().get("prop").getState()); + } + + @Test + public void testExtendsStringClient() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", "abc"); + ExtendsStringAdditionalProperties body + = new ExtendsStringAdditionalProperties("ExtendsStringAdditionalProperties"); + body.setAdditionalProperties(propertyMap); + extendsStringClient.put(body); + + ExtendsStringAdditionalProperties properties = extendsStringClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals("ExtendsStringAdditionalProperties", properties.getName()); + Assertions.assertEquals(propertyMap, properties.getAdditionalProperties()); + } + + @Test + public void testExtendsUnknownClient() { + Map additionalProperty = new LinkedHashMap<>(); + additionalProperty.put("prop1", BinaryData.fromObject(32)); + additionalProperty.put("prop2", BinaryData.fromObject(true)); + additionalProperty.put("prop3", BinaryData.fromObject("abc")); + ExtendsUnknownAdditionalProperties body + = new ExtendsUnknownAdditionalProperties("ExtendsUnknownAdditionalProperties"); + body.setAdditionalProperties(additionalProperty); + extendsUnknownClient.put(body); + + ExtendsUnknownAdditionalProperties properties = extendsUnknownClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals("ExtendsUnknownAdditionalProperties", properties.getName()); + BinaryDataUtils.assertMapEquals(additionalProperty, properties.getAdditionalProperties()); + } + + @Test + public void testExtendsUnknownDerivedClient() { + Map additionalProperty = new LinkedHashMap<>(); + additionalProperty.put("prop1", BinaryData.fromObject(32)); + additionalProperty.put("prop2", BinaryData.fromObject(true)); + additionalProperty.put("prop3", BinaryData.fromObject("abc")); + ExtendsUnknownAdditionalPropertiesDerived body + = new ExtendsUnknownAdditionalPropertiesDerived("ExtendsUnknownAdditionalProperties", 314).setAge(2.71875); + body.setAdditionalProperties(additionalProperty); + extendsUnknownDerivedClient.put(body); + + ExtendsUnknownAdditionalPropertiesDerived properties = extendsUnknownDerivedClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals("ExtendsUnknownAdditionalProperties", properties.getName()); + BinaryDataUtils.assertMapEquals(additionalProperty, properties.getAdditionalProperties()); + } + + @Test + public void testExtendsUnknownDiscriminatedClient() { + Map additionalProperty = new LinkedHashMap<>(); + additionalProperty.put("prop1", BinaryData.fromObject(32)); + additionalProperty.put("prop2", BinaryData.fromObject(true)); + additionalProperty.put("prop3", BinaryData.fromObject("abc")); + ExtendsUnknownAdditionalPropertiesDiscriminatedDerived body + = new ExtendsUnknownAdditionalPropertiesDiscriminatedDerived("Derived", 314).setAge(2.71875); + body.setAdditionalProperties(additionalProperty); + extendsUnknownDiscriminatedClient.put(body); + + ExtendsUnknownAdditionalPropertiesDiscriminated properties = extendsUnknownDiscriminatedClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals("Derived", properties.getName()); + BinaryDataUtils.assertMapEquals(additionalProperty, properties.getAdditionalProperties()); + } + + @Test + public void testExtendsDifferentSpreadString() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", "abc"); + DifferentSpreadStringDerived body = new DifferentSpreadStringDerived(43.125, "abc"); + body.setAdditionalProperties(propertyMap); + extendsDifferentSpreadStringClient.put(body); + + DifferentSpreadStringDerived record = extendsDifferentSpreadStringClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals(43.125, record.getId()); + Assertions.assertEquals("abc", record.getDerivedProp()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertEquals("abc", record.getAdditionalProperties().get("prop")); + } + + @Test + public void testExtendsDifferentSpreadFloat() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", 43.125); + DifferentSpreadFloatDerived body = new DifferentSpreadFloatDerived("abc", 43.125); + body.setAdditionalProperties(propertyMap); + extendsDifferentSpreadFloatClient.put(body); + + DifferentSpreadFloatDerived record = extendsDifferentSpreadFloatClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getName()); + Assertions.assertEquals(43.125, record.getDerivedProp()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertEquals(43.125, record.getAdditionalProperties().get("prop")); + } + + @Test + public void testExtendsDifferentSpreadModel() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", new ModelForRecord("ok")); + DifferentSpreadModelDerived body = new DifferentSpreadModelDerived("abc", new ModelForRecord("ok")); + body.setAdditionalProperties(propertyMap); + extendsDifferentSpreadModelClient.put(body); + + DifferentSpreadModelDerived record = extendsDifferentSpreadModelClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getKnownProp()); + Assertions.assertEquals("ok", record.getDerivedProp().getState()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + Assertions.assertEquals("ok", record.getAdditionalProperties().get("prop").getState()); + } + + @Test + public void testExtendsDifferentSpreadModelArray() { + Map> propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + DifferentSpreadModelArrayDerived body = new DifferentSpreadModelArrayDerived("abc", + Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + body.setAdditionalProperties(propertyMap); + extendsDifferentSpreadModelArrayClient.put(body); + + DifferentSpreadModelArrayDerived record = extendsDifferentSpreadModelArrayClient.get(); + Assertions.assertNotNull(record); + Assertions.assertNotNull(record.getDerivedProp()); + record.getDerivedProp().forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + record.getAdditionalProperties() + .get("prop") + .forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsFloatClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsFloatClientTest.java new file mode 100644 index 0000000000..485d3196c9 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsFloatClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import java.util.LinkedHashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.additionalproperties.models.IsFloatAdditionalProperties; + +public class IsFloatClientTest { + private final IsFloatClient client = new AdditionalPropertiesClientBuilder().buildIsFloatClient(); + + @Test + public void testPullAndGet() { + IsFloatAdditionalProperties body = new IsFloatAdditionalProperties(43.125); + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", 43.125); + body.setAdditionalProperties(propertyMap); + client.put(body); + + IsFloatAdditionalProperties properties = client.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertIterableEquals(propertyMap.entrySet(), properties.getAdditionalProperties().entrySet()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsModelArrayClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsModelArrayClientTest.java new file mode 100644 index 0000000000..df1b8549fd --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsModelArrayClientTest.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.additionalproperties.models.IsModelArrayAdditionalProperties; +import type.property.additionalproperties.models.ModelForRecord; + +public class IsModelArrayClientTest { + private final IsModelArrayClient client = new AdditionalPropertiesClientBuilder().buildIsModelArrayClient(); + + @Test + public void testPullAndGet() { + Map> propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + IsModelArrayAdditionalProperties body + = new IsModelArrayAdditionalProperties(Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + body.setAdditionalProperties(propertyMap); + client.put(body); + + IsModelArrayAdditionalProperties properties = client.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getKnownProp()); + properties.getKnownProp().forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertNotNull(properties.getAdditionalProperties().get("prop")); + properties.getAdditionalProperties() + .get("prop") + .forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsModelClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsModelClientTest.java new file mode 100644 index 0000000000..c03e2fa879 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsModelClientTest.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import java.util.LinkedHashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.additionalproperties.models.IsModelAdditionalProperties; +import type.property.additionalproperties.models.ModelForRecord; + +public class IsModelClientTest { + private final IsModelClient client = new AdditionalPropertiesClientBuilder().buildIsModelClient(); + + @Test + public void testPullAndGet() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", new ModelForRecord("ok")); + IsModelAdditionalProperties body = new IsModelAdditionalProperties(new ModelForRecord("ok")); + body.setAdditionalProperties(propertyMap); + client.put(body); + + IsModelAdditionalProperties properties = client.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getKnownProp()); + Assertions.assertEquals("ok", properties.getKnownProp().getState()); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertNotNull(properties.getAdditionalProperties().get("prop")); + Assertions.assertEquals("ok", properties.getAdditionalProperties().get("prop").getState()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsStringClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsStringClientTest.java new file mode 100644 index 0000000000..ba9da02158 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsStringClientTest.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import java.util.LinkedHashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.additionalproperties.models.IsStringAdditionalProperties; + +public class IsStringClientTest { + private final IsStringClient client = new AdditionalPropertiesClientBuilder().buildIsStringClient(); + + @Test + public void testPullAndGet() { + IsStringAdditionalProperties body = new IsStringAdditionalProperties("IsStringAdditionalProperties"); + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", "abc"); + body.setAdditionalProperties(propertyMap); + client.put(body); + + IsStringAdditionalProperties properties = client.get(); + Assertions.assertNotNull(properties); + Assertions.assertEquals("IsStringAdditionalProperties", properties.getName()); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertIterableEquals(propertyMap.entrySet(), properties.getAdditionalProperties().entrySet()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsUnknownClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsUnknownClientTest.java new file mode 100644 index 0000000000..c96aa71f64 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/IsUnknownClientTest.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import com.azure.core.util.BinaryData; +import java.util.LinkedHashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.utils.BinaryDataUtils; +import type.property.additionalproperties.models.IsUnknownAdditionalProperties; +import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDerived; +import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminated; +import type.property.additionalproperties.models.IsUnknownAdditionalPropertiesDiscriminatedDerived; + +public class IsUnknownClientTest { + private final IsUnknownClient client = new AdditionalPropertiesClientBuilder().buildIsUnknownClient(); + private final IsUnknownDerivedClient isUnknownDerivedClient + = new AdditionalPropertiesClientBuilder().buildIsUnknownDerivedClient(); + private final IsUnknownDiscriminatedClient isUnknownDiscriminatedClient + = new AdditionalPropertiesClientBuilder().buildIsUnknownDiscriminatedClient(); + + @Test + public void testPullAndGet() { + IsUnknownAdditionalProperties body = new IsUnknownAdditionalProperties("IsUnknownAdditionalProperties"); + Map additionalProperty = new LinkedHashMap<>(); + additionalProperty.put("prop1", BinaryData.fromObject(32)); + additionalProperty.put("prop2", BinaryData.fromObject(true)); + additionalProperty.put("prop3", BinaryData.fromObject("abc")); + body.setAdditionalProperties(additionalProperty); + client.put(body); + + IsUnknownAdditionalProperties properties = client.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals("IsUnknownAdditionalProperties", properties.getName()); + BinaryDataUtils.assertMapEquals(additionalProperty, properties.getAdditionalProperties()); + } + + @Test + public void testIsUnknownDerivedClient() { + Map additionalProperty = new LinkedHashMap<>(); + additionalProperty.put("prop1", BinaryData.fromObject(32)); + additionalProperty.put("prop2", BinaryData.fromObject(true)); + additionalProperty.put("prop3", BinaryData.fromObject("abc")); + + IsUnknownAdditionalPropertiesDerived body + = new IsUnknownAdditionalPropertiesDerived("IsUnknownAdditionalProperties", 314).setAge(2.71875); + body.setAdditionalProperties(additionalProperty); + isUnknownDerivedClient.put(body); + + IsUnknownAdditionalPropertiesDerived properties = isUnknownDerivedClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals(2.71875, properties.getAge()); + Assertions.assertEquals(314, properties.getIndex()); + BinaryDataUtils.assertMapEquals(additionalProperty, properties.getAdditionalProperties()); + } + + @Test + public void testIsUnknownDiscriminatedClient() { + Map additionalProperty = new LinkedHashMap<>(); + additionalProperty.put("prop1", BinaryData.fromObject(32)); + additionalProperty.put("prop2", BinaryData.fromObject(true)); + additionalProperty.put("prop3", BinaryData.fromObject("abc")); + + IsUnknownAdditionalPropertiesDiscriminatedDerived body + = new IsUnknownAdditionalPropertiesDiscriminatedDerived("Derived", 314).setAge(2.71875); + body.setAdditionalProperties(additionalProperty); + isUnknownDiscriminatedClient.put(body); + + IsUnknownAdditionalPropertiesDiscriminated properties = isUnknownDiscriminatedClient.get(); + Assertions.assertNotNull(properties); + Assertions.assertNotNull(properties.getAdditionalProperties()); + Assertions.assertEquals("Derived", properties.getName()); + BinaryDataUtils.assertMapEquals(additionalProperty, properties.getAdditionalProperties()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/MultipleSpreadTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/MultipleSpreadTests.java new file mode 100644 index 0000000000..6e889286c1 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/MultipleSpreadTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import com.azure.core.util.BinaryData; +import java.util.LinkedHashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.additionalproperties.models.MultipleSpreadRecord; + +public class MultipleSpreadTests { + private final MultipleSpreadClient multipleSpreadClient + = new AdditionalPropertiesClientBuilder().buildMultipleSpreadClient(); + + @Test + public void testMultipleSpread() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop1", BinaryData.fromObject("abc")); + propertyMap.put("prop2", BinaryData.fromObject(43.125)); + MultipleSpreadRecord body = new MultipleSpreadRecord(true); + body.setAdditionalProperties(propertyMap); + multipleSpreadClient.put(body); + + MultipleSpreadRecord record = multipleSpreadClient.get(); + Assertions.assertNotNull(record); + Assertions.assertTrue(record.isFlag()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertEquals("abc", record.getAdditionalProperties().get("prop1").toObject(String.class)); + Assertions.assertEquals(43.125, record.getAdditionalProperties().get("prop2").toObject(Double.class)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/SpreadTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/SpreadTests.java new file mode 100644 index 0000000000..cc3d0873ca --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/additionalproperties/SpreadTests.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.additionalproperties; + +import com.azure.core.util.BinaryData; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.additionalproperties.models.DifferentSpreadFloatRecord; +import type.property.additionalproperties.models.DifferentSpreadModelArrayRecord; +import type.property.additionalproperties.models.DifferentSpreadModelRecord; +import type.property.additionalproperties.models.DifferentSpreadStringRecord; +import type.property.additionalproperties.models.ModelForRecord; +import type.property.additionalproperties.models.SpreadFloatRecord; +import type.property.additionalproperties.models.SpreadModelArrayRecord; +import type.property.additionalproperties.models.SpreadModelRecord; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion2; +import type.property.additionalproperties.models.SpreadRecordForNonDiscriminatedUnion3; +import type.property.additionalproperties.models.SpreadRecordForUnion; +import type.property.additionalproperties.models.SpreadStringRecord; +import type.property.additionalproperties.models.WidgetData0; +import type.property.additionalproperties.models.WidgetData1; +import type.property.additionalproperties.models.WidgetData2; + +public class SpreadTests { + private final SpreadStringClient spreadStringClient + = new AdditionalPropertiesClientBuilder().buildSpreadStringClient(); + private final SpreadFloatClient spreadFloatClient + = new AdditionalPropertiesClientBuilder().buildSpreadFloatClient(); + private final SpreadModelClient spreadModelClient + = new AdditionalPropertiesClientBuilder().buildSpreadModelClient(); + private final SpreadModelArrayClient spreadModelArrayClient + = new AdditionalPropertiesClientBuilder().buildSpreadModelArrayClient(); + private final SpreadDifferentStringClient spreadDifferentStringClient + = new AdditionalPropertiesClientBuilder().buildSpreadDifferentStringClient(); + private final SpreadDifferentFloatClient spreadDifferentFloatClient + = new AdditionalPropertiesClientBuilder().buildSpreadDifferentFloatClient(); + private final SpreadDifferentModelClient spreadDifferentModelClient + = new AdditionalPropertiesClientBuilder().buildSpreadDifferentModelClient(); + private final SpreadDifferentModelArrayClient spreadDifferentModelArrayClient + = new AdditionalPropertiesClientBuilder().buildSpreadDifferentModelArrayClient(); + private final SpreadRecordUnionClient spreadRecordUnionClient + = new AdditionalPropertiesClientBuilder().buildSpreadRecordUnionClient(); + private final SpreadRecordNonDiscriminatedUnionClient spreadRecordNonDiscriminatedUnionClient + = new AdditionalPropertiesClientBuilder().buildSpreadRecordNonDiscriminatedUnionClient(); + private final SpreadRecordNonDiscriminatedUnion2Client spreadRecordNonDiscriminatedUnion2Client + = new AdditionalPropertiesClientBuilder().buildSpreadRecordNonDiscriminatedUnion2Client(); + private final SpreadRecordNonDiscriminatedUnion3Client spreadRecordNonDiscriminatedUnion3Client + = new AdditionalPropertiesClientBuilder().buildSpreadRecordNonDiscriminatedUnion3Client(); + + @Test + public void testSpreadString() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", "abc"); + SpreadStringRecord body = new SpreadStringRecord("SpreadSpringRecord"); + body.setAdditionalProperties(propertyMap); + spreadStringClient.put(body); + + SpreadStringRecord record = spreadStringClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("SpreadSpringRecord", record.getName()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + Assertions.assertEquals("abc", record.getAdditionalProperties().get("prop")); + } + + @Test + public void testSpreadFloat() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", 43.125); + SpreadFloatRecord body = new SpreadFloatRecord(43.125); + body.setAdditionalProperties(propertyMap); + spreadFloatClient.put(body); + + SpreadFloatRecord record = spreadFloatClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals(43.125, record.getId()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + Assertions.assertEquals(43.125, record.getAdditionalProperties().get("prop")); + } + + @Test + public void testSpreadModel() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", new ModelForRecord("ok")); + SpreadModelRecord body = new SpreadModelRecord(new ModelForRecord("ok")); + body.setAdditionalProperties(propertyMap); + spreadModelClient.put(body); + + SpreadModelRecord record = spreadModelClient.get(); + Assertions.assertNotNull(record); + Assertions.assertNotNull(record.getKnownProp()); + Assertions.assertEquals("ok", record.getKnownProp().getState()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + Assertions.assertEquals("ok", record.getAdditionalProperties().get("prop").getState()); + } + + @Test + public void testSpreadModelArray() { + Map> propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + SpreadModelArrayRecord body + = new SpreadModelArrayRecord(Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + body.setAdditionalProperties(propertyMap); + spreadModelArrayClient.put(body); + + SpreadModelArrayRecord record = spreadModelArrayClient.get(); + Assertions.assertNotNull(record); + Assertions.assertNotNull(record.getKnownProp()); + record.getKnownProp().forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + record.getAdditionalProperties() + .get("prop") + .forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + } + + @Test + public void testSpreadDifferentString() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", "abc"); + DifferentSpreadStringRecord body = new DifferentSpreadStringRecord(43.125); + body.setAdditionalProperties(propertyMap); + spreadDifferentStringClient.put(body); + + DifferentSpreadStringRecord record = spreadDifferentStringClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals(43.125, record.getId()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertEquals("abc", record.getAdditionalProperties().get("prop")); + } + + @Test + public void testSpreadDifferentFloat() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", 43.125); + DifferentSpreadFloatRecord body = new DifferentSpreadFloatRecord("abc"); + body.setAdditionalProperties(propertyMap); + spreadDifferentFloatClient.put(body); + + DifferentSpreadFloatRecord record = spreadDifferentFloatClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getName()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertEquals(43.125, record.getAdditionalProperties().get("prop")); + } + + @Test + public void testSpreadDifferentModel() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", new ModelForRecord("ok")); + DifferentSpreadModelRecord body = new DifferentSpreadModelRecord("abc"); + body.setAdditionalProperties(propertyMap); + spreadDifferentModelClient.put(body); + + DifferentSpreadModelRecord record = spreadDifferentModelClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getKnownProp()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + Assertions.assertEquals("ok", record.getAdditionalProperties().get("prop").getState()); + } + + @Test + public void testSpreadDifferentModelArray() { + Map> propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop", Arrays.asList(new ModelForRecord("ok"), new ModelForRecord("ok"))); + DifferentSpreadModelArrayRecord body = new DifferentSpreadModelArrayRecord("abc"); + body.setAdditionalProperties(propertyMap); + spreadDifferentModelArrayClient.put(body); + + DifferentSpreadModelArrayRecord record = spreadDifferentModelArrayClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getKnownProp()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop")); + record.getAdditionalProperties() + .get("prop") + .forEach(modelForRecord -> Assertions.assertEquals("ok", modelForRecord.getState())); + } + + @Test + public void testSpreadRecordUnion() { + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop1", BinaryData.fromObject("abc")); + propertyMap.put("prop2", BinaryData.fromObject(43.125f)); + SpreadRecordForUnion body = new SpreadRecordForUnion(true); + body.setAdditionalProperties(propertyMap); + spreadRecordUnionClient.put(body); + + SpreadRecordForUnion record = spreadRecordUnionClient.get(); + Assertions.assertNotNull(record); + Assertions.assertTrue(record.isFlag()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop1")); + Assertions.assertEquals("abc", record.getAdditionalProperties().get("prop1").toObject(String.class)); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop2")); + Assertions.assertEquals(43.125f, record.getAdditionalProperties().get("prop2").toObject(Float.class)); + } + +// @Test +// public void testSpreadRecordDiscriminatedUnion() { +// BinaryData binaryDataProp1 = BinaryData.fromObject(new WidgetData0("abc")); +// BinaryData binaryDataProp2 = BinaryData.fromObject(new WidgetData1(OffsetDateTime.parse("2021-01-01T00:00:00Z")) +// .setEnd(OffsetDateTime.parse("2021-01-02T00:00:00Z"))); +// Map propertyMap = new LinkedHashMap<>(); +// propertyMap.put("prop1", binaryDataProp1); +// propertyMap.put("prop2", binaryDataProp2); +// SpreadRecordForDiscriminatedUnion body = new SpreadRecordForDiscriminatedUnion("abc"); +// body.setAdditionalProperties(propertyMap); +// spreadRecordDiscriminatedUnionClient.put(body); +// +// SpreadRecordForDiscriminatedUnion record = spreadRecordDiscriminatedUnionClient.get(); +// Assertions.assertNotNull(record); +// Assertions.assertEquals("abc", record.getName()); +// Assertions.assertNotNull(record.getAdditionalProperties()); +// Assertions.assertNotNull(record.getAdditionalProperties().get("prop1")); +// Assertions.assertEquals(binaryDataProp1.toObject(Map.class), +// record.getAdditionalProperties().get("prop1").toObject(Map.class)); +// Assertions.assertNotNull(record.getAdditionalProperties().get("prop2")); +// Assertions.assertEquals(binaryDataProp2.toObject(Map.class), +// record.getAdditionalProperties().get("prop2").toObject(Map.class)); +// } + + @Test + public void testSpreadRecordNonDiscriminatedUnion() { + BinaryData binaryDataProp1 = BinaryData.fromObject(new WidgetData0("abc")); + BinaryData binaryDataProp2 = BinaryData.fromObject(new WidgetData1(OffsetDateTime.parse("2021-01-01T00:00:00Z")) + .setEnd(OffsetDateTime.parse("2021-01-02T00:00:00Z"))); + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop1", binaryDataProp1); + propertyMap.put("prop2", binaryDataProp2); + SpreadRecordForNonDiscriminatedUnion body = new SpreadRecordForNonDiscriminatedUnion("abc"); + body.setAdditionalProperties(propertyMap); + spreadRecordNonDiscriminatedUnionClient.put(body); + + SpreadRecordForNonDiscriminatedUnion record = spreadRecordNonDiscriminatedUnionClient.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getName()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop1")); + Assertions.assertEquals(binaryDataProp1.toObject(Map.class), + record.getAdditionalProperties().get("prop1").toObject(Map.class)); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop2")); + Assertions.assertEquals(binaryDataProp2.toObject(Map.class), + record.getAdditionalProperties().get("prop2").toObject(Map.class)); + } + + @Test + public void testSpreadRecordNonDiscriminatedUnion2() { + BinaryData binaryDataProp1 = BinaryData.fromObject(new WidgetData2("2021-01-01T00:00:00Z")); + BinaryData binaryDataProp2 = BinaryData.fromObject(new WidgetData1(OffsetDateTime.parse("2021-01-01T00:00:00Z")) + .setEnd(OffsetDateTime.parse("2021-01-02T00:00:00Z"))); + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop1", binaryDataProp1); + propertyMap.put("prop2", binaryDataProp2); + SpreadRecordForNonDiscriminatedUnion2 body = new SpreadRecordForNonDiscriminatedUnion2("abc"); + body.setAdditionalProperties(propertyMap); + spreadRecordNonDiscriminatedUnion2Client.put(body); + + SpreadRecordForNonDiscriminatedUnion2 record = spreadRecordNonDiscriminatedUnion2Client.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getName()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop1")); + Assertions.assertEquals(binaryDataProp1.toObject(Map.class), + record.getAdditionalProperties().get("prop1").toObject(Map.class)); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop2")); + Assertions.assertEquals(binaryDataProp2.toObject(Map.class), + record.getAdditionalProperties().get("prop2").toObject(Map.class)); + } + + @Test + public void testSpreadRecordNonDiscriminatedUnion3() { + BinaryData binaryDataProp1 = BinaryData.fromObject( + Arrays.asList(new WidgetData2("2021-01-01T00:00:00Z"), new WidgetData2("2021-01-01T00:00:00Z"))); + BinaryData binaryDataProp2 = BinaryData.fromObject(new WidgetData1(OffsetDateTime.parse("2021-01-01T00:00:00Z")) + .setEnd(OffsetDateTime.parse("2021-01-02T00:00:00Z"))); + Map propertyMap = new LinkedHashMap<>(); + propertyMap.put("prop1", binaryDataProp1); + propertyMap.put("prop2", binaryDataProp2); + SpreadRecordForNonDiscriminatedUnion3 body = new SpreadRecordForNonDiscriminatedUnion3("abc"); + body.setAdditionalProperties(propertyMap); + spreadRecordNonDiscriminatedUnion3Client.put(body); + + SpreadRecordForNonDiscriminatedUnion3 record = spreadRecordNonDiscriminatedUnion3Client.get(); + Assertions.assertNotNull(record); + Assertions.assertEquals("abc", record.getName()); + Assertions.assertNotNull(record.getAdditionalProperties()); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop1")); + Assertions.assertIterableEquals(binaryDataProp1.toObject(List.class), + record.getAdditionalProperties().get("prop1").toObject(List.class)); + Assertions.assertNotNull(record.getAdditionalProperties().get("prop2")); + Assertions.assertEquals(binaryDataProp2.toObject(Map.class), + record.getAdditionalProperties().get("prop2").toObject(Map.class)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/BytesClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/BytesClientTest.java new file mode 100644 index 0000000000..2ea5e7d4d8 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/BytesClientTest.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.nullable; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.nullable.models.BytesProperty; + +class BytesClientTest { + + BytesClient client = new NullableClientBuilder().buildBytesClient(); + + @Test + void patchNonNullWithResponse() { + byte[] input = new byte[] { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33 }; + BytesProperty bytesProperty = new BytesProperty().setRequiredProperty("foo").setNullableProperty(input); + client.patchNonNull(bytesProperty); + } + + @Test + void patchNullWithResponse() { + client.patchNull(new BytesProperty().setRequiredProperty("foo").setNullableProperty(null)); + } + + @Test + void getNonNull() { + BytesProperty response = client.getNonNull(); + Assertions.assertNotNull(response.getNullableProperty()); + } + + @Test + void getNull() { + BytesProperty response = client.getNull(); + Assertions.assertNull(response.getNullableProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsByteClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsByteClientTest.java new file mode 100644 index 0000000000..0bb2886044 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsByteClientTest.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.nullable; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import type.property.nullable.models.CollectionsByteProperty; + +class CollectionsByteClientTest { + + CollectionsByteClient client = new NullableClientBuilder().buildCollectionsByteClient(); + + @Test + void patchNonNullWithResponse() { + CollectionsByteProperty collectionsByteProperty = new CollectionsByteProperty().setRequiredProperty("foo") + .setNullableProperty( + Arrays.asList(new byte[] { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33 }, + new byte[] { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33 })); + client.patchNonNull(collectionsByteProperty); + } + + @Test + void patchNullWithResponse() { + client.patchNull(new CollectionsByteProperty().setRequiredProperty("foo").setNullableProperty(null)); + } + + @Test + void getNonNull() { + CollectionsByteProperty response = client.getNonNull(); + assertNotNull(response.getNullableProperty()); + } + + @Test + void getNull() { + CollectionsByteProperty response = client.getNull(); + assertNull(response.getNullableProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsModelClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsModelClientTest.java new file mode 100644 index 0000000000..45344f91b1 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsModelClientTest.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.nullable; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import type.property.nullable.models.CollectionsModelProperty; +import type.property.nullable.models.InnerModel; + +class CollectionsModelClientTest { + + CollectionsModelClient client = new NullableClientBuilder().buildCollectionsModelClient(); + + @Test + void patchNonNullWithResponse() { + CollectionsModelProperty property = new CollectionsModelProperty().setRequiredProperty("foo") + .setNullableProperty( + Arrays.asList(new InnerModel().setProperty("hello"), new InnerModel().setProperty("world"))); + client.patchNonNull(property); + } + + @Test + void patchNullWithResponse() { + client.patchNull(new CollectionsModelProperty().setRequiredProperty("foo").setNullableProperty(null)); + } + + @Test + void getNonNull() { + CollectionsModelProperty response = client.getNonNull(); + assertNotNull(response.getNullableProperty()); + } + + @Test + void getNull() { + CollectionsModelProperty response = client.getNull(); + assertNull(response.getNullableProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsStringClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsStringClientTest.java new file mode 100644 index 0000000000..242d5b343e --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/CollectionsStringClientTest.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.nullable; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertIterableEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.Arrays; +import org.junit.jupiter.api.Test; +import type.property.nullable.models.CollectionsStringProperty; + +public class CollectionsStringClientTest { + + private final CollectionsStringClient client = new NullableClientBuilder().buildCollectionsStringClient(); + + @Test + public void patchNonNull() { + CollectionsStringProperty property = new CollectionsStringProperty().setRequiredProperty("foo") + .setNullableProperty(Arrays.asList("hello", "world")); + client.patchNonNull(property); + } + + @Test + public void patchNull() { + client.patchNull(new CollectionsStringProperty().setRequiredProperty("foo").setNullableProperty(null)); + } + + @Test + public void getNonNull() { + CollectionsStringProperty response = client.getNonNull(); + assertNotNull(response.getRequiredProperty()); + assertNotNull(response.getNullableProperty()); + assertEquals("foo", response.getRequiredProperty()); + assertIterableEquals(Arrays.asList("hello", "world"), response.getNullableProperty()); + } + + @Test + public void getNull() { + CollectionsStringProperty response = client.getNull(); + assertNotNull(response.getRequiredProperty()); + assertEquals("foo", response.getRequiredProperty()); + assertNull(response.getNullableProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/DatetimeOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/DatetimeOperationClientTest.java new file mode 100644 index 0000000000..ca682763f3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/DatetimeOperationClientTest.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.nullable; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import type.property.nullable.models.DatetimeProperty; + +class DatetimeOperationClientTest { + + DatetimeOperationClient client = new NullableClientBuilder().buildDatetimeOperationClient(); + + @Test + void patchNonNullWithResponse() { + OffsetDateTime offsetDateTime = OffsetDateTime.parse("2022-08-26T18:38:00Z"); + DatetimeProperty datetimeProperty + = new DatetimeProperty().setRequiredProperty("foo").setNullableProperty(offsetDateTime); + client.patchNonNull(datetimeProperty); + } + + @Test + void patchNullWithResponse() { + client.patchNull(new DatetimeProperty().setRequiredProperty("foo").setNullableProperty(null)); + } + + @Test + void getNonNull() { + DatetimeProperty response = client.getNonNull(); + assertNotNull(response.getNullableProperty()); + } + + @Test + void getNull() { + DatetimeProperty response = client.getNull(); + assertNull(response.getNullableProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/DurationOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/DurationOperationClientTest.java new file mode 100644 index 0000000000..5022686887 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/DurationOperationClientTest.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.nullable; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.time.Duration; +import org.junit.jupiter.api.Test; +import type.property.nullable.models.DurationProperty; + +class DurationOperationClientTest { + + DurationOperationClient client = new NullableClientBuilder().buildDurationOperationClient(); + + @Test + void patchNonNullWithResponse() { + DurationProperty property = new DurationProperty().setRequiredProperty("foo") + .setNullableProperty(Duration.parse("PT2974H14M12.011S")); + client.patchNonNull(property); + } + + @Test + void patchNullWithResponse() { + client.patchNull(new DurationProperty().setRequiredProperty("foo").setNullableProperty(null)); + } + + @Test + void getNonNull() { + DurationProperty response = client.getNonNull(); + assertNotNull(response.getNullableProperty()); + } + + @Test + void getNull() { + DurationProperty response = client.getNull(); + assertNull(response.getNullableProperty()); + + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/StringClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/StringClientTests.java new file mode 100644 index 0000000000..176e5733ab --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/nullable/StringClientTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.nullable; + +import java.io.IOException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.nullable.models.StringProperty; + +public class StringClientTests { + + private final StringOperationClient stringClient = new NullableClientBuilder().buildStringOperationClient(); + + @Test + public void testStringNullable() throws IOException { + + Assertions.assertEquals("hello", stringClient.getNonNull().getNullableProperty()); + + Assertions.assertNull(stringClient.getNull().getNullableProperty()); + + stringClient.patchNonNull(new StringProperty().setRequiredProperty("foo").setNullableProperty("hello")); + + stringClient.patchNull(new StringProperty().setRequiredProperty("foo").setNullableProperty(null)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/BooleanLiteralClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/BooleanLiteralClientTests.java new file mode 100644 index 0000000000..8722bf4a5e --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/BooleanLiteralClientTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.BooleanLiteralProperty; +import type.property.optional.models.BooleanLiteralPropertyProperty; + +public class BooleanLiteralClientTests { + private final BooleanLiteralClient client = new OptionalClientBuilder().buildBooleanLiteralClient(); + + @Test + public void getAll() { + BooleanLiteralProperty booleanLiteralProperty = client.getAll(); + Assertions.assertEquals(BooleanLiteralPropertyProperty.TRUE, booleanLiteralProperty.getProperty()); + } + + @Test + public void getDefault() { + BooleanLiteralProperty booleanLiteralProperty = client.getDefault(); + Assertions.assertNull(booleanLiteralProperty.getProperty()); + } + + @Test + public void putAll() { + BooleanLiteralProperty booleanLiteralProperty = new BooleanLiteralProperty(); + booleanLiteralProperty.setProperty(BooleanLiteralPropertyProperty.TRUE); + client.putAll(booleanLiteralProperty); + } + + @Test + public void putDefault() { + BooleanLiteralProperty booleanLiteralProperty = new BooleanLiteralProperty(); + client.putDefault(booleanLiteralProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/BytesClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/BytesClientTest.java new file mode 100644 index 0000000000..00d2b87219 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/BytesClientTest.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.BytesProperty; + +class BytesClientTest { + + BytesClient bytesClient = new OptionalClientBuilder().buildBytesClient(); + + @Test + void getAll() { + BytesProperty bytesProperty = bytesClient.getAll(); + Assertions.assertNotNull(bytesProperty.getProperty()); + } + + @Test + void putAll() { + BytesProperty bytesProperty = new BytesProperty(); + bytesProperty.setProperty(new byte[] { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33 }); + bytesClient.putAll(bytesProperty); + } + + @Test + void getDefault() { + BytesProperty bytesProperty = bytesClient.getDefault(); + Assertions.assertNull(bytesProperty.getProperty()); + } + + @Test + void putDefault() { + BytesProperty bytesProperty = new BytesProperty(); + bytesClient.putDefault(bytesProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/CollectionsByteClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/CollectionsByteClientTest.java new file mode 100644 index 0000000000..f14aa5d521 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/CollectionsByteClientTest.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.CollectionsByteProperty; + +class CollectionsByteClientTest { + + CollectionsByteClient client = new OptionalClientBuilder().buildCollectionsByteClient(); + + @Test + void getAll() { + CollectionsByteProperty collectionsByteProperty = client.getAll(); + for (byte[] p : collectionsByteProperty.getProperty()) { + Assertions.assertNotNull(p); + } + } + + @Test + void getDefault() { + CollectionsByteProperty collectionsByteProperty = client.getDefault(); + Assertions.assertNull(collectionsByteProperty.getProperty()); + } + + @Test + void putAll() { + CollectionsByteProperty collectionsByteProperty = new CollectionsByteProperty(); + byte[] byteProperty = new byte[] { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33 }; + collectionsByteProperty.setProperty(Arrays.asList(byteProperty, byteProperty)); + client.putAll(collectionsByteProperty); + } + + @Test + void putDefault() { + CollectionsByteProperty collectionsByteProperty = new CollectionsByteProperty(); + client.putDefault(collectionsByteProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/CollectionsModelClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/CollectionsModelClientTest.java new file mode 100644 index 0000000000..27fd19e53b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/CollectionsModelClientTest.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.CollectionsModelProperty; +import type.property.optional.models.StringProperty; + +class CollectionsModelClientTest { + + CollectionsModelClient client = new OptionalClientBuilder().buildCollectionsModelClient(); + + @Test + void getAll() { + CollectionsModelProperty collectionsModelProperty = client.getAll(); + List properties = collectionsModelProperty.getProperty(); + Assertions.assertEquals("hello", properties.get(0).getProperty()); + Assertions.assertEquals("world", properties.get(1).getProperty()); + } + + @Test + void getDefault() { + CollectionsModelProperty collectionsModelProperty = client.getDefault(); + Assertions.assertNull(collectionsModelProperty.getProperty()); + } + + @Test + void putAll() { + CollectionsModelProperty collectionsModelProperty = new CollectionsModelProperty(); + StringProperty stringProperty1 = new StringProperty(); + StringProperty stringProperty2 = new StringProperty(); + stringProperty1.setProperty("hello"); + stringProperty2.setProperty("world"); + collectionsModelProperty.setProperty(Arrays.asList(stringProperty1, stringProperty2)); + client.putAll(collectionsModelProperty); + } + + @Test + void putDefault() { + CollectionsModelProperty collectionsModelProperty = new CollectionsModelProperty(); + client.putDefault(collectionsModelProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/DatetimeOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/DatetimeOperationClientTest.java new file mode 100644 index 0000000000..b797b2131c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/DatetimeOperationClientTest.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.DatetimeProperty; + +class DatetimeOperationClientTest { + + DatetimeOperationClient client = new OptionalClientBuilder().buildDatetimeOperationClient(); + + @Test + void getAll() { + DatetimeProperty datetimeProperty = client.getAll(); + Assertions.assertEquals("2022-08-26T18:38Z", datetimeProperty.getProperty().toString()); + } + + @Test + void getDefault() { + DatetimeProperty datetimeProperty = client.getDefault(); + Assertions.assertNull(datetimeProperty.getProperty()); + } + + @Test + void putAll() { + OffsetDateTime offsetDateTime = OffsetDateTime.parse("2022-08-26T18:38Z"); + DatetimeProperty datetimeProperty = new DatetimeProperty(); + datetimeProperty.setProperty(offsetDateTime); + client.putAll(datetimeProperty); + } + + @Test + void putDefault() { + DatetimeProperty datetimeProperty = new DatetimeProperty(); + client.putDefault(datetimeProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/DurationOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/DurationOperationClientTest.java new file mode 100644 index 0000000000..8752b85ef8 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/DurationOperationClientTest.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import java.time.Duration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.DurationProperty; + +class DurationOperationClientTest { + + DurationOperationClient client = new OptionalClientBuilder().buildDurationOperationClient(); + + @Test + void getAll() { + DurationProperty durationProperty = client.getAll(); + Assertions.assertEquals("PT2974H14M12.011S", durationProperty.getProperty().toString()); + } + + @Test + void getDefault() { + DurationProperty durationProperty = client.getDefault(); + Assertions.assertNull(durationProperty.getProperty()); + } + + @Test + void putAll() { + Duration duration = Duration.parse("PT2974H14M12.011S"); + DurationProperty property = new DurationProperty(); + property.setProperty(duration); + client.putAll(property); + } + + @Test + void putDefault() { + DurationProperty property = new DurationProperty(); + client.putDefault(property); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/FloatLiteralClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/FloatLiteralClientTests.java new file mode 100644 index 0000000000..d8522b66c7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/FloatLiteralClientTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.FloatLiteralProperty; +import type.property.optional.models.FloatLiteralPropertyProperty; + +public class FloatLiteralClientTests { + private final FloatLiteralClient client = new OptionalClientBuilder().buildFloatLiteralClient(); + + @Test + public void getAll() { + FloatLiteralProperty floatLiteralProperty = client.getAll(); + Assertions.assertEquals(FloatLiteralPropertyProperty.ONE_TWO_FIVE, floatLiteralProperty.getProperty()); + } + + @Test + public void getDefault() { + FloatLiteralProperty floatLiteralProperty = client.getDefault(); + Assertions.assertNull(floatLiteralProperty.getProperty()); + } + + @Test + public void putAll() { + FloatLiteralProperty floatLiteralProperty = new FloatLiteralProperty(); + floatLiteralProperty.setProperty(FloatLiteralPropertyProperty.ONE_TWO_FIVE); + client.putAll(floatLiteralProperty); + } + + @Test + public void putDefault() { + FloatLiteralProperty floatLiteralProperty = new FloatLiteralProperty(); + client.putDefault(floatLiteralProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/IntLiteralClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/IntLiteralClientTests.java new file mode 100644 index 0000000000..d91da22df2 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/IntLiteralClientTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.IntLiteralProperty; +import type.property.optional.models.IntLiteralPropertyProperty; + +public class IntLiteralClientTests { + private final IntLiteralClient client = new OptionalClientBuilder().buildIntLiteralClient(); + + @Test + public void getAll() { + IntLiteralProperty intLiteralProperty = client.getAll(); + Assertions.assertEquals(IntLiteralPropertyProperty.ONE, intLiteralProperty.getProperty()); + } + + @Test + public void getDefault() { + IntLiteralProperty intLiteralProperty = client.getDefault(); + Assertions.assertNull(intLiteralProperty.getProperty()); + } + + @Test + public void putAll() { + IntLiteralProperty intLiteralProperty = new IntLiteralProperty(); + intLiteralProperty.setProperty(IntLiteralPropertyProperty.ONE); + client.putAll(intLiteralProperty); + } + + @Test + public void putDefault() { + IntLiteralProperty intLiteralProperty = new IntLiteralProperty(); + client.putDefault(intLiteralProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/PlainDateClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/PlainDateClientTests.java new file mode 100644 index 0000000000..10763bf3dd --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/PlainDateClientTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import java.time.LocalDate; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.PlainDateProperty; + +public class PlainDateClientTests { + private final PlainDateClient client = new OptionalClientBuilder().buildPlainDateClient(); + + @Test + public void getAll() { + PlainDateProperty PlainDateProperty = client.getAll(); + Assertions.assertEquals(LocalDate.parse("2022-12-12"), PlainDateProperty.getProperty()); + } + + @Test + public void getDefault() { + PlainDateProperty PlainDateProperty = client.getDefault(); + Assertions.assertNull(PlainDateProperty.getProperty()); + } + + @Test + public void putAll() { + client.putAll(new PlainDateProperty().setProperty(LocalDate.parse("2022-12-12"))); + } + + @Test + public void putDefault() { + client.putDefault(new PlainDateProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/PlainTimeClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/PlainTimeClientTests.java new file mode 100644 index 0000000000..8a9acf0b45 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/PlainTimeClientTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.PlainTimeProperty; + +public class PlainTimeClientTests { + private final PlainTimeClient client = new OptionalClientBuilder().buildPlainTimeClient(); + + @Test + public void getAll() { + Assertions.assertEquals("13:06:12", client.getAll().getProperty()); + } + + @Test + public void getDefault() { + Assertions.assertNull(client.getDefault().getProperty()); + } + + @Test + public void putAll() { + client.putAll(new PlainTimeProperty().setProperty("13:06:12")); + } + + @Test + public void putDefault() { + client.putDefault(new PlainTimeProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/RequiredAndOptionalClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/RequiredAndOptionalClientTest.java new file mode 100644 index 0000000000..d006ab8180 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/RequiredAndOptionalClientTest.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.RequiredAndOptionalProperty; + +class RequiredAndOptionalClientTest { + RequiredAndOptionalClient client = new OptionalClientBuilder().buildRequiredAndOptionalClient(); + + @Test + void getAll() { + RequiredAndOptionalProperty requiredAndOptionalProperty = client.getAll(); + Assertions.assertEquals("hello", requiredAndOptionalProperty.getOptionalProperty()); + Assertions.assertEquals(42, requiredAndOptionalProperty.getRequiredProperty()); + } + + @Test + void getRequiredOnly() { + RequiredAndOptionalProperty requiredAndOptionalProperty = client.getRequiredOnly(); + Assertions.assertEquals(42, requiredAndOptionalProperty.getRequiredProperty()); + Assertions.assertNull(requiredAndOptionalProperty.getOptionalProperty()); + } + + @Test + void putAll() { + RequiredAndOptionalProperty requiredAndOptionalProperty = new RequiredAndOptionalProperty(42); + requiredAndOptionalProperty.setOptionalProperty("hello"); + client.putAll(requiredAndOptionalProperty); + } + + @Test + void putRequiredOnly() { + RequiredAndOptionalProperty requiredAndOptionalProperty = new RequiredAndOptionalProperty(42); + client.putRequiredOnly(requiredAndOptionalProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/StringLiteralClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/StringLiteralClientTests.java new file mode 100644 index 0000000000..a6f2573917 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/StringLiteralClientTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.StringLiteralProperty; +import type.property.optional.models.StringLiteralPropertyProperty; + +public class StringLiteralClientTests { + private final StringLiteralClient client = new OptionalClientBuilder().buildStringLiteralClient(); + + @Test + public void getAll() { + StringLiteralProperty stringLiteralProperty = client.getAll(); + Assertions.assertEquals(StringLiteralPropertyProperty.HELLO, stringLiteralProperty.getProperty()); + } + + @Test + public void getDefault() { + StringLiteralProperty stringLiteralProperty = client.getDefault(); + Assertions.assertNull(stringLiteralProperty.getProperty()); + } + + @Test + public void putAll() { + StringLiteralProperty stringLiteralProperty = new StringLiteralProperty(); + stringLiteralProperty.setProperty(StringLiteralPropertyProperty.HELLO); + client.putAll(stringLiteralProperty); + } + + @Test + public void putDefault() { + StringLiteralProperty stringLiteralProperty = new StringLiteralProperty(); + client.putDefault(stringLiteralProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/StringOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/StringOperationClientTest.java new file mode 100644 index 0000000000..87f7a550f3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/StringOperationClientTest.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.StringProperty; + +class StringOperationClientTest { + + StringOperationClient client = new OptionalClientBuilder().buildStringOperationClient(); + + @Test + void getAll() { + StringProperty stringProperty = client.getAll(); + Assertions.assertEquals("hello", stringProperty.getProperty()); + } + + @Test + void getDefault() { + StringProperty stringProperty = client.getDefault(); + Assertions.assertNull(stringProperty.getProperty()); + } + + @Test + void putAll() { + StringProperty stringProperty = new StringProperty(); + stringProperty.setProperty("hello"); + client.putAll(stringProperty); + } + + @Test + void putDefault() { + StringProperty stringProperty = new StringProperty(); + client.putDefault(stringProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionFloatLiteralClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionFloatLiteralClientTests.java new file mode 100644 index 0000000000..0d339e7e9c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionFloatLiteralClientTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.UnionFloatLiteralProperty; +import type.property.optional.models.UnionFloatLiteralPropertyProperty; + +public class UnionFloatLiteralClientTests { + private final UnionFloatLiteralClient client = new OptionalClientBuilder().buildUnionFloatLiteralClient(); + + @Test + public void getAll() { + UnionFloatLiteralProperty unionFloatLiteralProperty = client.getAll(); + Assertions.assertEquals(UnionFloatLiteralPropertyProperty.TWO_THREE_SEVEN_FIVE, + unionFloatLiteralProperty.getProperty()); + } + + @Test + public void getDefault() { + UnionFloatLiteralProperty unionFloatLiteralProperty = client.getDefault(); + Assertions.assertNull(unionFloatLiteralProperty.getProperty()); + } + + @Test + public void putAll() { + UnionFloatLiteralProperty unionFloatLiteralProperty = new UnionFloatLiteralProperty(); + unionFloatLiteralProperty.setProperty(UnionFloatLiteralPropertyProperty.TWO_THREE_SEVEN_FIVE); + client.putAll(unionFloatLiteralProperty); + } + + @Test + public void putDefault() { + UnionFloatLiteralProperty unionFloatLiteralProperty = new UnionFloatLiteralProperty(); + client.putDefault(unionFloatLiteralProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionIntLiteralClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionIntLiteralClientTests.java new file mode 100644 index 0000000000..c3c3a41091 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionIntLiteralClientTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.UnionIntLiteralProperty; +import type.property.optional.models.UnionIntLiteralPropertyProperty; + +public class UnionIntLiteralClientTests { + private final UnionIntLiteralClient client = new OptionalClientBuilder().buildUnionIntLiteralClient(); + + @Test + public void getAll() { + UnionIntLiteralProperty unionIntLiteralProperty = client.getAll(); + Assertions.assertEquals(UnionIntLiteralPropertyProperty.TWO, unionIntLiteralProperty.getProperty()); + } + + @Test + public void getDefault() { + UnionIntLiteralProperty unionIntLiteralProperty = client.getDefault(); + Assertions.assertNull(unionIntLiteralProperty.getProperty()); + } + + @Test + public void putAll() { + UnionIntLiteralProperty unionIntLiteralProperty = new UnionIntLiteralProperty(); + unionIntLiteralProperty.setProperty(UnionIntLiteralPropertyProperty.TWO); + client.putAll(unionIntLiteralProperty); + } + + @Test + public void putDefault() { + UnionIntLiteralProperty unionIntLiteralProperty = new UnionIntLiteralProperty(); + client.putDefault(unionIntLiteralProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionStringLiteralClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionStringLiteralClientTests.java new file mode 100644 index 0000000000..c8b7efc081 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/optional/UnionStringLiteralClientTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.optional; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.optional.models.UnionStringLiteralProperty; +import type.property.optional.models.UnionStringLiteralPropertyProperty; + +public class UnionStringLiteralClientTests { + private final UnionStringLiteralClient client = new OptionalClientBuilder().buildUnionStringLiteralClient(); + + @Test + public void getAll() { + UnionStringLiteralProperty unionStringLiteralProperty = client.getAll(); + Assertions.assertEquals(UnionStringLiteralPropertyProperty.WORLD, unionStringLiteralProperty.getProperty()); + } + + @Test + public void getDefault() { + UnionStringLiteralProperty unionStringLiteralProperty = client.getDefault(); + Assertions.assertNull(unionStringLiteralProperty.getProperty()); + } + + @Test + public void putAll() { + UnionStringLiteralProperty unionStringLiteralProperty = new UnionStringLiteralProperty(); + unionStringLiteralProperty.setProperty(UnionStringLiteralPropertyProperty.WORLD); + client.putAll(unionStringLiteralProperty); + } + + @Test + public void putDefault() { + UnionStringLiteralProperty unionStringLiteralProperty = new UnionStringLiteralProperty(); + client.putDefault(unionStringLiteralProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/BooleanOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/BooleanOperationClientTest.java new file mode 100644 index 0000000000..264eb9110e --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/BooleanOperationClientTest.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.BooleanProperty; + +class BooleanOperationClientTest { + + BooleanOperationClient client = new ValueTypesClientBuilder().buildBooleanOperationClient(); + + @Test + void get() { + BooleanProperty response = client.get(); + Assertions.assertTrue(response.isProperty()); + } + + @Test + void put() { + BooleanProperty booleanProperty = new BooleanProperty(true); + client.put(booleanProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/BytesClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/BytesClientTest.java new file mode 100644 index 0000000000..eefacb968b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/BytesClientTest.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.BytesProperty; + +class BytesClientTest { + + BytesClient client = new ValueTypesClientBuilder().buildBytesClient(); + + @Test + void get() { + BytesProperty bytesProperty = client.get(); + Assertions.assertNotNull(bytesProperty.getProperty()); + } + + @Test + void put() { + byte[] input = new byte[] { 104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33 }; + BytesProperty bytesProperty = new BytesProperty(input); + client.put(bytesProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsIntClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsIntClientTest.java new file mode 100644 index 0000000000..cf7b3046ae --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsIntClientTest.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.CollectionsIntProperty; + +class CollectionsIntClientTest { + + CollectionsIntClient client = new ValueTypesClientBuilder().buildCollectionsIntClient(); + + @Test + void get() { + CollectionsIntProperty collectionsIntProperty = client.get(); + List properties = collectionsIntProperty.getProperty(); + Assertions.assertEquals(1, properties.get(0)); + Assertions.assertEquals(2, properties.get(1)); + } + + @Test + void put() { + CollectionsIntProperty collectionsIntProperty = new CollectionsIntProperty(Arrays.asList(1, 2)); + client.put(collectionsIntProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsModelClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsModelClientTest.java new file mode 100644 index 0000000000..2c0cfb6ec5 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsModelClientTest.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.CollectionsModelProperty; +import type.property.valuetypes.models.InnerModel; + +class CollectionsModelClientTest { + + CollectionsModelClient client = new ValueTypesClientBuilder().buildCollectionsModelClient(); + + @Test + void get() { + CollectionsModelProperty collectionsModelProperty = client.get(); + List properties = collectionsModelProperty.getProperty(); + Assertions.assertEquals("hello", properties.get(0).getProperty()); + Assertions.assertEquals("world", properties.get(1).getProperty()); + } + + @Test + void put() { + InnerModel innerModel1 = new InnerModel("hello"); + InnerModel innerModel2 = new InnerModel("world"); + List properties = Arrays.asList(innerModel1, innerModel2); + CollectionsModelProperty collectionsModelProperty = new CollectionsModelProperty(properties); + client.put(collectionsModelProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsStringClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsStringClientTest.java new file mode 100644 index 0000000000..ab07cf8efc --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/CollectionsStringClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.CollectionsStringProperty; + +class CollectionsStringClientTest { + + CollectionsStringClient client = new ValueTypesClientBuilder().buildCollectionsStringClient(); + + @Test + void get() { + CollectionsStringProperty collectionsStringProperty = client.get(); + Assertions.assertEquals("hello", collectionsStringProperty.getProperty().get(0)); + Assertions.assertEquals("world", collectionsStringProperty.getProperty().get(1)); + } + + @Test + void put() { + CollectionsStringProperty collectionsStringProperty + = new CollectionsStringProperty(Arrays.asList("hello", "world")); + client.put(collectionsStringProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DatetimeOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DatetimeOperationClientTest.java new file mode 100644 index 0000000000..850fa9e7a7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DatetimeOperationClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.DatetimeProperty; + +class DatetimeOperationClientTest { + + DatetimeOperationClient client = new ValueTypesClientBuilder().buildDatetimeOperationClient(); + + @Test + void get() { + DatetimeProperty datetimeProperty = client.get(); + Assertions.assertEquals("2022-08-26T18:38Z", datetimeProperty.getProperty().toString()); + } + + @Test + void put() { + OffsetDateTime offsetDateTime = OffsetDateTime.parse("2022-08-26T18:38Z"); + DatetimeProperty datetimeProperty = new DatetimeProperty(offsetDateTime); + client.put(datetimeProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DecimalTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DecimalTests.java new file mode 100644 index 0000000000..27a051bcd7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DecimalTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Test; + +public class DecimalTests { + + private final DecimalClient client1 = new ValueTypesClientBuilder().buildDecimalClient(); + private final Decimal128Client client2 = new ValueTypesClientBuilder().buildDecimal128Client(); + + @Test + public void test() { + client1.put(client1.get()); + + client2.put(client2.get()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DictionaryStringClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DictionaryStringClientTest.java new file mode 100644 index 0000000000..50f6023ebc --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DictionaryStringClientTest.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.DictionaryStringProperty; + +class DictionaryStringClientTest { + + DictionaryStringClient client = new ValueTypesClientBuilder().buildDictionaryStringClient(); + + @Test + void get() { + DictionaryStringProperty dictionaryStringProperty = client.get(); + Map property = dictionaryStringProperty.getProperty(); + Assertions.assertEquals("hello", property.get("k1")); + Assertions.assertEquals("world", property.get("k2")); + } + + @Test + void put() { + Map property = new HashMap<>(); + property.put("k1", "hello"); + property.put("k2", "world"); + DictionaryStringProperty dictionaryStringProperty = new DictionaryStringProperty(property); + client.put(dictionaryStringProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DurationOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DurationOperationClientTest.java new file mode 100644 index 0000000000..76ec993816 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/DurationOperationClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import java.time.Duration; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.DurationProperty; + +class DurationOperationClientTest { + + DurationOperationClient client = new ValueTypesClientBuilder().buildDurationOperationClient(); + + @Test + void get() { + DurationProperty durationProperty = client.get(); + Assertions.assertEquals("PT2974H14M12.011S", durationProperty.getProperty().toString()); + } + + @Test + void put() { + Duration duration = Duration.parse("PT2974H14M12.011S"); + DurationProperty property = new DurationProperty(duration); + client.put(property); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/EnumClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/EnumClientTest.java new file mode 100644 index 0000000000..f6db85442d --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/EnumClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.EnumProperty; +import type.property.valuetypes.models.FixedInnerEnum; + +class EnumClientTest { + + EnumClient client = new ValueTypesClientBuilder().buildEnumClient(); + + @Test + void get() { + EnumProperty enumProperty = client.get(); + FixedInnerEnum innerEnum = enumProperty.getProperty(); + Assertions.assertEquals("ValueOne", innerEnum.toString()); + } + + @Test + void put() { + FixedInnerEnum innerEnum = FixedInnerEnum.VALUE_ONE; + EnumProperty enumProperty = new EnumProperty(innerEnum); + client.put(enumProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/EnumValueTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/EnumValueTests.java new file mode 100644 index 0000000000..d1ad6ed9fc --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/EnumValueTests.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Test; + +public class EnumValueTests { + + private final UnionEnumValueClient client = new ValueTypesClientBuilder().buildUnionEnumValueClient(); + + @Test + public void test() { + client.put(client.get()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/ExtensibleEnumClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/ExtensibleEnumClientTest.java new file mode 100644 index 0000000000..9d67df88c6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/ExtensibleEnumClientTest.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.ExtensibleEnumProperty; +import type.property.valuetypes.models.InnerEnum; + +class ExtensibleEnumClientTest { + + ExtensibleEnumClient client = new ValueTypesClientBuilder().buildExtensibleEnumClient(); + + @Test + void get() { + ExtensibleEnumProperty extensibleEnumProperty = client.get(); + InnerEnum innerExtensibleEnum = extensibleEnumProperty.getProperty(); + Assertions.assertEquals("UnknownValue", innerExtensibleEnum.toString()); + } + + @Test + void put() { + ExtensibleEnumProperty extensibleEnumProperty + = new ExtensibleEnumProperty(InnerEnum.fromString("UnknownValue")); + client.put(extensibleEnumProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/FloatOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/FloatOperationClientTest.java new file mode 100644 index 0000000000..d0aec0f736 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/FloatOperationClientTest.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.FloatProperty; + +class FloatOperationClientTest { + + FloatOperationClient client = new ValueTypesClientBuilder().buildFloatOperationClient(); + + @Test + void get() { + FloatProperty floatProperty = client.get(); + Assertions.assertEquals(43.125, floatProperty.getProperty()); + } + + @Test + void put() { + FloatProperty floatProperty = new FloatProperty(43.125); + client.put(floatProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/IntClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/IntClientTest.java new file mode 100644 index 0000000000..34002c11e8 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/IntClientTest.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.IntProperty; + +class IntClientTest { + + IntClient client = new ValueTypesClientBuilder().buildIntClient(); + + @Test + void get() { + IntProperty intProperty = client.get(); + Assertions.assertEquals(42, intProperty.getProperty()); + } + + @Test + void put() { + IntProperty intProperty = new IntProperty(42); + client.put(intProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/LiteralTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/LiteralTests.java new file mode 100644 index 0000000000..520d85b68c --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/LiteralTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.BooleanLiteralProperty; +import type.property.valuetypes.models.FloatLiteralProperty; +import type.property.valuetypes.models.IntLiteralProperty; +import type.property.valuetypes.models.StringLiteralProperty; + +public class LiteralTests { + private final BooleanLiteralClient booleanLiteralClient = new ValueTypesClientBuilder().buildBooleanLiteralClient(); + private final FloatLiteralClient floatLiteralClient = new ValueTypesClientBuilder().buildFloatLiteralClient(); + private final IntLiteralClient intLiteralClient = new ValueTypesClientBuilder().buildIntLiteralClient(); + private final StringLiteralClient stringLiteralClient = new ValueTypesClientBuilder().buildStringLiteralClient(); + + @Test + public void testBooleanLiteral() { + BooleanLiteralProperty body = new BooleanLiteralProperty(); + booleanLiteralClient.put(body); + + Assertions.assertNotNull(booleanLiteralClient.get()); + Assertions.assertTrue(booleanLiteralClient.get().isProperty()); + } + + @Test + public void testFloatLiteral() { + FloatLiteralProperty body = new FloatLiteralProperty(); + floatLiteralClient.put(body); + + Assertions.assertNotNull(floatLiteralClient.get()); + Assertions.assertEquals(43.125, floatLiteralClient.get().getProperty()); + } + + @Test + public void testIntLiteralClient() { + IntLiteralProperty body = new IntLiteralProperty(); + intLiteralClient.put(body); + + Assertions.assertNotNull(intLiteralClient.get()); + Assertions.assertEquals(42, intLiteralClient.get().getProperty()); + } + + @Test + public void testStringLiteral() { + StringLiteralProperty body = new StringLiteralProperty(); + stringLiteralClient.put(body); + + Assertions.assertNotNull(stringLiteralClient.get()); + Assertions.assertEquals("hello", stringLiteralClient.get().getProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/ModelClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/ModelClientTest.java new file mode 100644 index 0000000000..97af8fdb03 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/ModelClientTest.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.InnerModel; +import type.property.valuetypes.models.ModelProperty; + +class ModelClientTest { + + ModelClient client = new ValueTypesClientBuilder().buildModelClient(); + + @Test + void get() { + ModelProperty modelProperty = client.get(); + Assertions.assertEquals("hello", modelProperty.getProperty().getProperty()); + } + + @Test + void put() { + InnerModel innerModel = new InnerModel("hello"); + ModelProperty modelProperty = new ModelProperty(innerModel); + client.put(modelProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/NeverClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/NeverClientTest.java new file mode 100644 index 0000000000..80742caad6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/NeverClientTest.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.NeverProperty; + +class NeverClientTest { + + NeverClient client = new ValueTypesClientBuilder().buildNeverClient(); + + @Test + void get() { + NeverProperty response = client.get(); + Assertions.assertNotNull(response); + } + + @Test + void put() { + client.put(new NeverProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/StringOperationClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/StringOperationClientTest.java new file mode 100644 index 0000000000..baecb532da --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/StringOperationClientTest.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.StringProperty; + +class StringOperationClientTest { + + StringOperationClient client = new ValueTypesClientBuilder().buildStringOperationClient(); + + @Test + void get() { + StringProperty stringProperty = client.get(); + Assertions.assertEquals("hello", stringProperty.getProperty()); + } + + @Test + void put() { + StringProperty stringProperty = new StringProperty("hello"); + client.put(stringProperty); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/UnionTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/UnionTests.java new file mode 100644 index 0000000000..d7b6000559 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/UnionTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.UnionFloatLiteralProperty; +import type.property.valuetypes.models.UnionFloatLiteralPropertyProperty; +import type.property.valuetypes.models.UnionIntLiteralProperty; +import type.property.valuetypes.models.UnionIntLiteralPropertyProperty; +import type.property.valuetypes.models.UnionStringLiteralProperty; +import type.property.valuetypes.models.UnionStringLiteralPropertyProperty; + +public class UnionTests { + private final UnionStringLiteralClient unionStringClient + = new ValueTypesClientBuilder().buildUnionStringLiteralClient(); + private final UnionFloatLiteralClient unionFloatClient + = new ValueTypesClientBuilder().buildUnionFloatLiteralClient(); + private final UnionIntLiteralClient unionIntClient = new ValueTypesClientBuilder().buildUnionIntLiteralClient(); + + @Test + public void testUnionStringLiteral() { + UnionStringLiteralProperty body = new UnionStringLiteralProperty(UnionStringLiteralPropertyProperty.WORLD); + unionStringClient.put(body); + + Assertions.assertNotNull(unionStringClient.get()); + Assertions.assertEquals(UnionStringLiteralPropertyProperty.WORLD, unionStringClient.get().getProperty()); + } + + @Test + public void testUnionFloatLiteral() { + UnionFloatLiteralProperty body + = new UnionFloatLiteralProperty(UnionFloatLiteralPropertyProperty.FOUR_SIX_EIGHT_SEVEN_FIVE); + unionFloatClient.put(body); + + Assertions.assertNotNull(unionFloatClient.get()); + Assertions.assertEquals(UnionFloatLiteralPropertyProperty.FOUR_SIX_EIGHT_SEVEN_FIVE, + unionFloatClient.get().getProperty()); + } + + @Test + public void testUnionIntLiteral() { + UnionIntLiteralProperty body = new UnionIntLiteralProperty(UnionIntLiteralPropertyProperty.FOUR_TWO); + unionIntClient.put(body); + + Assertions.assertNotNull(unionIntClient.get()); + Assertions.assertEquals(UnionIntLiteralPropertyProperty.FOUR_TWO, unionIntClient.get().getProperty()); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/UnknownTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/UnknownTests.java new file mode 100644 index 0000000000..a7aa71529a --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/property/valuetypes/UnknownTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.property.valuetypes; + +import com.azure.core.util.BinaryData; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.property.valuetypes.models.UnknownArrayProperty; +import type.property.valuetypes.models.UnknownDictProperty; +import type.property.valuetypes.models.UnknownIntProperty; +import type.property.valuetypes.models.UnknownStringProperty; + +public class UnknownTests { + + private final UnknownArrayClient arrayClient = new ValueTypesClientBuilder().buildUnknownArrayClient(); + private final UnknownDictClient dictClient = new ValueTypesClientBuilder().buildUnknownDictClient(); + private final UnknownIntClient intClient = new ValueTypesClientBuilder().buildUnknownIntClient(); + private final UnknownStringClient stringClient = new ValueTypesClientBuilder().buildUnknownStringClient(); + + @Test + public void testUnknownArray() { + List array = Arrays.asList("hello", "world"); + + arrayClient.put(new UnknownArrayProperty(BinaryData.fromObject(array))); + + Assertions.assertEquals(array, arrayClient.get().getProperty().toObject(List.class)); + } + + @Test + public void testUnknownDict() { + Map dict = new HashMap<>(); + dict.put("k1", "hello"); + dict.put("k2", 42); + + dictClient.put(new UnknownDictProperty(BinaryData.fromObject(dict))); + + Assertions.assertEquals(dict, dictClient.get().getProperty().toObject(Map.class)); + } + + @Test + public void testUnknownInt() { + int integer = 42; + + intClient.put(new UnknownIntProperty(BinaryData.fromObject(integer))); + + Assertions.assertEquals(integer, intClient.get().getProperty().toObject(Integer.class)); + } + + @Test + public void testUnknownString() { + String str = "hello"; + + stringClient.put(new UnknownStringProperty(BinaryData.fromObject(str))); + + Assertions.assertEquals(str, stringClient.get().getProperty().toObject(String.class)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/scalar/DecimalTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/scalar/DecimalTests.java new file mode 100644 index 0000000000..8851c5956d --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/scalar/DecimalTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.scalar; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.BinaryData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.math.BigDecimal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import type.property.valuetypes.models.DecimalProperty; + +public class DecimalTests { + + @Immutable + public static class DecimalJackson { + @JsonProperty("property") + private BigDecimal property; + + public DecimalJackson(@JsonProperty("property") BigDecimal property) { + this.property = property; + } + + public BigDecimal getProperty() { + return property; + } + } + + @ParameterizedTest + @ValueSource(classes = { DecimalProperty.class, DecimalJackson.class }) + public void testBigDecimal(Class clazz) { + // precision larger than double + BigDecimal value = new BigDecimal("12345678901234567890.1234567890"); + String json = BinaryData.fromObject(newInstance(clazz, value)).toString(); + var test = BinaryData.fromString(json).toObject(clazz); + Assertions.assertEquals(value, getProperty(clazz, test)); + + // make sure precision difference would cause NotEquals + Assertions.assertNotEquals(value, new BigDecimal("12345678901234567890.123456789")); + + // scientific + value = new BigDecimal("1.2345678901234567890E23"); + json = BinaryData.fromObject(newInstance(clazz, value)).toString(); + test = BinaryData.fromString(json).toObject(clazz); + Assertions.assertEquals(value, getProperty(clazz, test)); + + value = new BigDecimal("-1.2345678901234567890e-105"); + json = BinaryData.fromObject(newInstance(clazz, value)).toString(); + test = BinaryData.fromString(json).toObject(clazz); + Assertions.assertEquals(value, getProperty(clazz, test)); + } + + private static T newInstance(Class clazz, BigDecimal value) { + try { + return clazz.getDeclaredConstructor(BigDecimal.class).newInstance(value); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static BigDecimal getProperty(Class clazz, T obj) { + try { + return (BigDecimal) clazz.getDeclaredMethod("getProperty").invoke(obj); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/scalar/ScalarTests.java b/packages/typespec-java/emitter-tests/src/test/java/type/scalar/ScalarTests.java new file mode 100644 index 0000000000..6b806e4698 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/scalar/ScalarTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.scalar; + +import com.azure.core.util.BinaryData; +import java.math.BigDecimal; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ScalarTests { + + private final StringOperationClient stringClient = new ScalarClientBuilder().buildStringOperationClient(); + private final BooleanOperationClient booleanClient = new ScalarClientBuilder().buildBooleanOperationClient(); + private final UnknownClient unknownClient = new ScalarClientBuilder().buildUnknownClient(); + + private final DecimalTypeClient decimalClient1 = new ScalarClientBuilder().buildDecimalTypeClient(); + private final Decimal128TypeClient decimalClient2 = new ScalarClientBuilder().buildDecimal128TypeClient(); + private final DecimalVerifyClient decimalClient3 = new ScalarClientBuilder().buildDecimalVerifyClient(); + private final Decimal128VerifyClient decimalClient4 = new ScalarClientBuilder().buildDecimal128VerifyClient(); + + @Test + public void test() { + Assertions.assertEquals("test", stringClient.get()); + stringClient.put("test"); + + Assertions.assertTrue(booleanClient.get()); + booleanClient.put(true); + + Assertions.assertEquals("test", unknownClient.get().toObject(String.class)); + unknownClient.put(BinaryData.fromObject("test")); + } + + @Test + public void testDecimal() { + BigDecimal decimal = new BigDecimal("0.33333"); + + decimalClient1.requestBody(decimal); + decimalClient1.requestParameter(decimal); + Assertions.assertEquals(decimal, decimalClient1.responseBody()); + + decimalClient2.requestBody(decimal); + decimalClient2.requestParameter(decimal); + Assertions.assertEquals(decimal, decimalClient2.responseBody()); + + decimalClient3.verify(decimalClient3.prepareVerify().stream().reduce(BigDecimal.valueOf(0), BigDecimal::add)); + + decimalClient4.verify(decimalClient4.prepareVerify().stream().reduce(BigDecimal.valueOf(0), BigDecimal::add)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/type/union/UnionsClientTest.java b/packages/typespec-java/emitter-tests/src/test/java/type/union/UnionsClientTest.java new file mode 100644 index 0000000000..f9d52e37a8 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/type/union/UnionsClientTest.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package type.union; + +import com.azure.core.util.BinaryData; +import com.azure.core.util.serializer.TypeReference; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import type.union.models.Cat; +import type.union.models.EnumsOnlyCases; +import type.union.models.EnumsOnlyCasesLr; +import type.union.models.EnumsOnlyCasesUd; +import type.union.models.GetResponseProp; +import type.union.models.GetResponseProp1; +import type.union.models.GetResponseProp2; +import type.union.models.GetResponseProp3; +import type.union.models.MixedLiteralsCases; +import type.union.models.MixedTypesCases; +import type.union.models.StringAndArrayCases; +import type.union.models.StringExtensibleNamedUnion; + +public class UnionsClientTest { + + private final StringsOnlyClient client1 = new UnionClientBuilder().buildStringsOnlyClient(); + private final StringExtensibleClient client2 = new UnionClientBuilder().buildStringExtensibleClient(); + private final StringExtensibleNamedClient client3 = new UnionClientBuilder().buildStringExtensibleNamedClient(); + private final IntsOnlyClient client4 = new UnionClientBuilder().buildIntsOnlyClient(); + private final FloatsOnlyClient client5 = new UnionClientBuilder().buildFloatsOnlyClient(); + private final ModelsOnlyClient client6 = new UnionClientBuilder().buildModelsOnlyClient(); + private final EnumsOnlyClient client7 = new UnionClientBuilder().buildEnumsOnlyClient(); + private final StringAndArrayClient client8 = new UnionClientBuilder().buildStringAndArrayClient(); + private final MixedLiteralsClient client9 = new UnionClientBuilder().buildMixedLiteralsClient(); + private final MixedTypesClient client10 = new UnionClientBuilder().buildMixedTypesClient(); + + @Test + public void testStringsOnlyClient() { + GetResponseProp prop = client1.get().getProp(); + Assertions.assertEquals(GetResponseProp.B, prop); + client1.send(prop); + } + + @Test + public void testStringExtensibleClient() { + GetResponseProp1 prop = client2.get().getProp(); + Assertions.assertEquals("custom", prop.toString()); + client2.send(prop); + } + + @Test + public void testStringExtensibleNamedClient() { + StringExtensibleNamedUnion prop = client3.get().getProp(); + Assertions.assertEquals("custom", prop.toString()); + client3.send(prop); + } + + @Test + public void testIntsOnlyClient() { + GetResponseProp2 prop = client4.get().getProp(); + Assertions.assertEquals(2L, prop.toInt()); + client4.send(prop); + } + + @Test + public void testFloatsOnlyClient() { + GetResponseProp3 prop = client5.get().getProp(); + Assertions.assertEquals(2.2, prop.toDouble()); + client5.send(prop); + } + + @Test + public void testModelsOnlyClient() { + BinaryData prop = client6.get().getProp(); + Assertions.assertEquals("test", prop.toObject(Cat.class).getName()); + client6.send(BinaryData.fromObject(new Cat("test"))); + } + + @Test + public void testEnumsOnlyClient() { + EnumsOnlyCases prop = client7.get().getProp(); + Assertions.assertEquals(EnumsOnlyCasesLr.RIGHT, prop.getLr()); + Assertions.assertEquals(EnumsOnlyCasesUd.UP, prop.getUd()); + client7.send(prop); + } + + @Test + public void testStringAndArrayClient() { + StringAndArrayCases prop = client8.get().getProp(); + Assertions.assertEquals("test", prop.getString().toObject(String.class)); + Assertions.assertEquals(Arrays.asList("test1", "test2"), + prop.getArray().toObject(new TypeReference>() { + })); + client8.send(prop); + } + + @Test + public void testMixedLiteralsClient() { + MixedLiteralsCases prop = client9.get().getProp(); + Assertions.assertEquals("a", prop.getStringLiteral().toObject(String.class)); + Assertions.assertEquals(2L, prop.getIntLiteral().toObject(Long.class)); + Assertions.assertEquals(3.3, prop.getFloatLiteral().toObject(Double.class)); + Assertions.assertEquals(true, prop.getBooleanLiteral().toObject(Boolean.class)); + client9.send(prop); + } + + @Test + public void testMixedTypesClient() { + MixedTypesCases prop = client10.get().getProp(); + Assertions.assertEquals("test", prop.getModel().toObject(Cat.class).getName()); + Assertions.assertEquals("a", prop.getLiteral().toObject(String.class)); + Assertions.assertEquals(2L, prop.getIntProperty().toObject(Long.class)); + Assertions.assertEquals(true, prop.getBooleanProperty().toObject(Boolean.class)); + List array = prop.getArray(); + Assertions.assertEquals("test", array.get(0).toObject(Cat.class).getName()); + Assertions.assertEquals("a", array.get(1).toObject(String.class)); + Assertions.assertEquals(2L, array.get(2).toObject(Long.class)); + Assertions.assertEquals(true, array.get(3).toObject(Boolean.class)); + + client10.send(prop); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/versioning/added/AddedClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/versioning/added/AddedClientTests.java new file mode 100644 index 0000000000..3869a5db96 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/versioning/added/AddedClientTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package versioning.added; + +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Test; +import versioning.added.models.EnumV1; +import versioning.added.models.EnumV2; +import versioning.added.models.ModelV1; +import versioning.added.models.ModelV2; + +public class AddedClientTests { + private final AddedClient addedClient = new AddedClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(AddedServiceVersion.V2) + .buildClient(); + private final InterfaceV2Client interfaceV2Client = new AddedClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(AddedServiceVersion.V2) + .buildInterfaceV2Client(); + + @Test + public void testAddedClient() { + addedClient.v1("bar", new ModelV1("foo", EnumV1.ENUM_MEMBER_V2, BinaryData.fromObject(10))); + addedClient.v2(new ModelV2("foo", EnumV2.ENUM_MEMBER, BinaryData.fromObject("bar"))); + } + + @Test + public void testInterfaceV2Client() { + interfaceV2Client.v2InInterface(new ModelV2("foo", EnumV2.ENUM_MEMBER, BinaryData.fromObject("bar"))); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/versioning/madeoptional/MadeOptionalClienTests.java b/packages/typespec-java/emitter-tests/src/test/java/versioning/madeoptional/MadeOptionalClienTests.java new file mode 100644 index 0000000000..3b2d8a7b3a --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/versioning/madeoptional/MadeOptionalClienTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package versioning.madeoptional; + +import org.junit.jupiter.api.Test; +import versioning.madeoptional.models.TestModel; + +public class MadeOptionalClienTests { + private final MadeOptionalClient madeOptionalClient + = new MadeOptionalClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(MadeOptionalServiceVersion.V2) + .buildClient(); + + @Test + public void testMadeOptionalClient() { + madeOptionalClient.test(new TestModel("foo")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/versioning/removed/RemovedClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/versioning/removed/RemovedClientTests.java new file mode 100644 index 0000000000..f8f44e8c0d --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/versioning/removed/RemovedClientTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package versioning.removed; + +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Test; +import versioning.removed.models.EnumV2; +import versioning.removed.models.EnumV3; +import versioning.removed.models.ModelV2; +import versioning.removed.models.ModelV3; + +public class RemovedClientTests { + + private final RemovedClient removedClientV1 = new RemovedClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(RemovedServiceVersion.V1) + .buildClient(); + + private final RemovedClient removedClientV2 = new RemovedClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(RemovedServiceVersion.V2) + .buildClient(); + + private final RemovedClient removedClientV2Preview = new RemovedClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(RemovedServiceVersion.V2PREVIEW) + .buildClient(); + + @Test + public void tesRemovedClient() { + removedClientV2.v2(new ModelV2("foo", EnumV2.ENUM_MEMBER_V2, BinaryData.fromObject("bar"))); + } + + @Test + public void tesRemovedClientModelV3() { + removedClientV1.modelV3(new ModelV3("123", EnumV3.ENUM_MEMBER_V1)); + + removedClientV2.modelV3(new ModelV3("123", EnumV3.ENUM_MEMBER_V1)); + + // nothing can be done if property is removed from an api-version + removedClientV2Preview.modelV3(new ModelV3("123", null)); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/versioning/renamedfrom/RenamedFromClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/versioning/renamedfrom/RenamedFromClientTests.java new file mode 100644 index 0000000000..367411058b --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/versioning/renamedfrom/RenamedFromClientTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package versioning.renamedfrom; + +import com.azure.core.util.BinaryData; +import org.junit.jupiter.api.Test; +import versioning.renamedfrom.models.NewEnum; +import versioning.renamedfrom.models.NewModel; + +public class RenamedFromClientTests { + private final RenamedFromClient renamedFromClient = new RenamedFromClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(RenamedFromServiceVersion.V2) + .buildClient(); + private final NewInterfaceClient newInterfaceClient + = new RenamedFromClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(RenamedFromServiceVersion.V2) + .buildNewInterfaceClient(); + + @Test + public void testNewOp() { + renamedFromClient.newOp("bar", new NewModel("foo", NewEnum.NEW_ENUM_MEMBER, BinaryData.fromObject(10))); + } + + @Test + public void testNewOpInNewInterface() { + newInterfaceClient.newOpInNewInterface(new NewModel("foo", NewEnum.NEW_ENUM_MEMBER, BinaryData.fromObject(10))); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientTests.java new file mode 100644 index 0000000000..faac54ce53 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/versioning/returntypechangedfrom/ReturnTypeChangedFromClientTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package versioning.returntypechangedfrom; + +import org.junit.jupiter.api.Test; + +public class ReturnTypeChangedFromClientTests { + private final ReturnTypeChangedFromClient returnTypeChangedFromClient + = new ReturnTypeChangedFromClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(ReturnTypeChangedFromServiceVersion.V2) + .buildClient(); + + @Test + public void testReturnTypeChangedFromClient() { + returnTypeChangedFromClient.test("test"); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/java/versioning/typechangedfrom/TypeChangedFromClientTests.java b/packages/typespec-java/emitter-tests/src/test/java/versioning/typechangedfrom/TypeChangedFromClientTests.java new file mode 100644 index 0000000000..3e46fd1dad --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/java/versioning/typechangedfrom/TypeChangedFromClientTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package versioning.typechangedfrom; + +import org.junit.jupiter.api.Test; +import versioning.typechangedfrom.models.TestModel; + +public class TypeChangedFromClientTests { + private final TypeChangedFromClient typeChangedFromClient + = new TypeChangedFromClientBuilder().endpoint("http://localhost:3000") + .serviceVersion(TypeChangedFromServiceVersion.V2) + .buildClient(); + + @Test + public void testTypeChangedFromClient() { + typeChangedFromClient.test("baz", new TestModel("foo", "bar")); + } +} diff --git a/packages/typespec-java/emitter-tests/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/packages/typespec-java/emitter-tests/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 0000000000..1f0955d450 --- /dev/null +++ b/packages/typespec-java/emitter-tests/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/packages/typespec-java/emitter-tests/tsp-checkout.sh b/packages/typespec-java/emitter-tests/tsp-checkout.sh new file mode 100644 index 0000000000..7a887b6be0 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp-checkout.sh @@ -0,0 +1,22 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +export SPEC_REPO=https://github.com/bterlson/openai-in-typespec.git +export TSP_PATH=* +export REPO_BRANCH=main + +mkdir tsp-repo +cd tsp-repo +git init +git config core.sparseCheckout true +git remote add -f origin $SPEC_REPO +echo $TSP_PATH > .git/info/sparse-checkout +git checkout $REPO_BRANCH +cd .. + +if [ "$TSP_PATH" == "*" ]; then + cp -rf tsp-repo tsp-src +else + cp -rf tsp-repo/$TSP_PATH tsp-src +fi +rm -rf tsp-repo diff --git a/packages/typespec-java/emitter-tests/tsp/arm-customization.tsp b/packages/typespec-java/emitter-tests/tsp/arm-customization.tsp new file mode 100644 index 0000000000..fe67b54a89 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/arm-customization.tsp @@ -0,0 +1,53 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.ResourceManager; + +@armProviderNamespace +@service(#{ title: "ArmCustomization" }) +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace TspTest.ArmCustomization; + +@doc("Azure API versions.") +enum Versions { + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} + +model Vault is Azure.ResourceManager.Legacy.TrackedResourceWithOptionalLocation< + VaultProperties, + false +> { + ...ResourceNameParameter< + Resource = Vault, + KeyName = "vaultName", + SegmentName = "vaults", + NamePattern = "" + >; +} +/** + * Properties of the vault + */ +model VaultProperties { + /** + * Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. + */ + publicNetworkAccess?: string = "enabled"; +} + +@armResourceOperations +interface Vaults { + /** + * Gets the specified Azure key vault. + */ + get is ArmResourceRead; +} diff --git a/packages/typespec-java/emitter-tests/tsp/arm-legacy.tsp b/packages/typespec-java/emitter-tests/tsp/arm-legacy.tsp new file mode 100644 index 0000000000..dbb8f07452 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/arm-legacy.tsp @@ -0,0 +1,129 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.ResourceManager; +using Azure.ClientGenerator.Core; + +@armProviderNamespace +@service(#{ title: "ArmLegacy" }) +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace TspTest.ArmLegacy; + +enum Versions { + v2024_12_01: "2024-12-01", +} + +model SkuResource is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = SkuResource, + KeyName = "sku", + SegmentName = "skus", + NamePattern = "" + >; +} + +@armResourceOperations +interface Skus { + getNested is SkuNested.Read; + + createNested is SkuNested.CreateOrUpdateSync< + SkuResource, + Response = ArmResourceUpdatedResponse + >; + + deleteNested is SkuNested.DeleteSync; + + getRoot is SkuRoot.Read; + + createRoot is SkuRoot.CreateOrUpdateSync< + SkuResource, + Response = ArmResourceUpdatedResponse + >; + + deleteRoot is SkuRoot.DeleteSync; +} + +model ResourceTypeSku { + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; +} + +union ProvisioningState { + ResourceProvisioningState, + Provisioning: "Provisioning", + Updating: "Updating", + Deleting: "Deleting", + Accepted: "Accepted", +} + +interface SkuRoot + extends Azure.ResourceManager.Legacy.ExtensionOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** The name of the resource provider hosted within ProviderHub. */ + @path + @segment("providerRegistrations") + @key + providerNamespace: string, + + /** The resource type. */ + @path + @segment("resourcetypeRegistrations") + @key + resourceType: string, + }, + {}, + { + /** The SKU. */ + @path + @segment("skus") + @key + sku: string, + } + > {} + +interface SkuNested + extends Azure.ResourceManager.Legacy.ExtensionOperations< + { + ...ApiVersionParameter, + ...SubscriptionIdParameter, + ...Azure.ResourceManager.Legacy.Provider, + + /** The name of the resource provider hosted within ProviderHub. */ + @path + @segment("providerRegistrations") + @key + providerNamespace: string, + + /** The resource type. */ + @path + @segment("resourcetypeRegistrations") + @key + resourceType: string, + + /** The first child resource type. */ + @path + @segment("resourcetypeRegistrations") + @key + nestedResourceTypeFirst: string, + }, + {}, + { + /** The SKU. */ + @path + @segment("skus") + @key + sku: string, + } + > {} diff --git a/packages/typespec-java/emitter-tests/tsp/arm-stream-style-serialization.tsp b/packages/typespec-java/emitter-tests/tsp/arm-stream-style-serialization.tsp new file mode 100644 index 0000000000..0187de15f8 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/arm-stream-style-serialization.tsp @@ -0,0 +1,414 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ClientGenerator.Core; +using Azure.ClientGenerator.Core.Legacy; + +@armProviderNamespace +@service(#{ title: "ArmStreamStyleSerialization" }) +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace TspTest.ArmStreamStyleSerialization; + +@doc("Azure API versions.") +enum Versions { + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} + +@doc("This is base model for polymorphic multiple levels inheritance with a discriminator.") +@discriminator("kind") +model Fish { + age: int32; + + @visibility(Lifecycle.Read) + dna: string; + + properties: FishProperties; + anotherProperties: AnotherFishProperties; +} + +@doc("The second level model in polymorphic multiple levels inheritance and it defines a new discriminator.") +@discriminator("sharktype") +model Shark extends Fish { + kind: "shark"; + sharktype: string; +} + +@doc("The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic instances.") +model Salmon extends Fish { + kind: "salmon"; + friends?: Fish[]; + hate?: Record; + partner?: Fish; +} + +model FishProperties { + tailProperties: TailProperties; +} + +model TailProperties { + length: float32; + + @visibility(Lifecycle.Read) + patten: string; + + requiredString: string; +} + +model AnotherFishProperties { + eyeProperties: EyeProperties; +} + +model EyeProperties { + length: float32; + + @visibility(Lifecycle.Read) + patten: string; + + requiredString: string; +} + +@doc("The third level model SawShark in polymorphic multiple levels inheritance.") +model SawShark extends Shark { + sharktype: "saw"; + + // this is a duplicate property from Fish, with different visibility + dna: string; + + // this is a duplicate property from Fish, with same visibility + age: int32; +} + +@doc("The third level model GoblinShark in polymorphic multiple levels inheritance.") +model GoblinShark extends Shark { + sharktype: "goblin"; +} + +// test Resource as parent +@resource("topLevelArmResources") +model TopLevelArmResource is TrackedResource { + @key("topLevelArmResourceName") + @path + @segment("topLevelArmResources") + @doc("arm resource name for path") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +@doc("Top Level Arm Resource Properties.") +model TopLevelArmResourceProperties { + description?: string; + builtin: Builtin; +} + +@error +model ErrorResponseMax { + error: ErrorMax; +} + +@error +model ErrorResponseMin { + error: ErrorMin; +} + +model ErrorMax { + code: string; + message: string; + target: string; + details?: ErrorMax[]; + additionalInfo?: AdditionalInfo[]; + additionalProperty: string; +} + +model AdditionalInfo { + type: string; + info: {}; +} + +model ErrorMin { + code: string; + message: string; + additionalProperty: string; +} + +@doc("This is base model for polymorphic OutputOnlyModel.") +@discriminator("kind") +model OutputOnlyModel { + name: string; + + @visibility(Lifecycle.Read) + id: string; + + @flattenProperty + properties: OutputOnlyModelProperties; +} + +model OutputOnlyModelProperties { + title: string; + dog: Golden; +} + +@doc("extensible enum type for discriminator") +union DogKind { + string, + + @doc("Species golden") + Golden: "golden", +} + +@doc("Test extensible enum type for discriminator") +@discriminator("kind") +model Dog { + @doc("discriminator property") + kind: DogKind; + + @doc("Weight of the dog") + weight: int32; + + @doc("dna of the dog") + @visibility(Lifecycle.Read) + dna: string; +} + +@doc("Golden dog model") +model Golden extends Dog { + @doc("discriminator property") + kind: DogKind.Golden; +} + +model OutputOnlyModelChild extends OutputOnlyModel { + kind: "child"; + childName: string; +} + +model FunctionConfiguration { + input?: string; + output?: string; +} + +@discriminator("kind") +model FunctionProperties { + properties: FunctionConfiguration; +} + +model AggregateFunctionProperties extends FunctionProperties { + kind: "aggregate"; +} + +model Function { + properties: FunctionProperties; +} + +union Priority { + int32, + + @doc("high priority") + HIGH: 0, + + @doc("low priority") + LOW: 1, +} + +@route("/model") +interface Fishes { + @get + getModel(): Fish | ErrorResponseMax; + + @put + putModel(@body fish: Fish): Fish | ErrorResponseMin; + + @get + @route("output") + getOutputOnlyModel(): OutputOnlyModel; +} + +interface TopLevelArmResources { + update is ArmCustomPatchAsync; +} + +@route("/function") +interface Functions { + @put + createFunction( + @header `x-ms-authorization-auxiliary`?: string, + @body function: Function, + ): Function & { + @header("ETag") + @clientName("etag") + eTag: string; + }; +} + +@route("/priority") +interface Priorities { + @post + setPriority(@query priority: Priority): { + @header("Content-Type") contentType: "application/json"; + @body body: Priority; + }; +} + +@route("/items") +interface Items { + // op of LRO + pageable + @get + @list + list(): ListResult & ArmLroLocationHeader; + + @get + @list + @route("summary") + summary(): ListResultSummary; + + @get + @list + @route("list2") + list2(): ListResult2; + + @get + @route("summary2") + summary2(): ListResultSummary2; + + @get + @list + @route("list3") + list3(): ListResult3; + + @post + post(@body body: ListResult3): void; +} + +// model does not contain `@pageItems` property, but inherit them from parent +model ListResultSummary extends ListResult { + summary?: string; +} + +model ListResult { + @pageItems + items: Result[]; + + @nextLink + nextLink?: string; +} + +// This paged model need to be public (instead of in "implementation" package), as its child ListResultSummary2 is public +model ListResult2 { + @pageItems + items: Result[]; + + @nextLink + nextLink?: string; +} + +// This paged model need to be public (instead of in "implementation" package), as it is referenced in public API or public model +@access(Access.public) +model ListResult3 { + @pageItems + items: Result[]; + + @nextLink + nextLink?: string; +} + +model ListResultSummary2 extends ListResult2 { + summary?: string; +} + +model Result { + name: string; + + @visibility(Lifecycle.Read) + data: ResultData; +} + +model ResultData { + prop1: string; + + @visibility(Lifecycle.Read) + prop2: string; +} + +// test the serializaton of "unknown" +@usage(Usage.input | Usage.output) +model Builtin { + boolean: boolean; + string: string; + bytes: bytes; + int: int32; + safeint: safeint; + decimal: decimal; + long: int64; + float: float32; + double: float64; + duration: duration; + date: plainDate; + dateTime: utcDateTime; + stringList: string[]; + bytesDict: Record; + url: url; + nullableFloatDict: Record; + encoding: Encoded; + uuid: Azure.Core.uuid; + `unknown`: unknown; + unknownDict: Record; + unknownArray: unknown[]; + unknownDictArray: Record[]; +} + +@encode(DurationKnownEncoding.seconds, float32) +scalar myDuration extends duration; + +model Encoded { + @encode(DurationKnownEncoding.seconds, int32) + timeInSeconds?: duration; + + @encode(DurationKnownEncoding.seconds, int32) + timeInSecondsPrimitive: duration; + + timeInSecondsFraction?: myDuration; + timeInSecondsFractionPrimitive: myDuration; + + @encode(DateTimeKnownEncoding.rfc3339) + dateTime?: utcDateTime; + + @encode(DateTimeKnownEncoding.rfc7231) + dateTimeRfc7231?: utcDateTime; + + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + unixTimestamp?: utcDateTime; + + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + unixTimestampPrimitive: utcDateTime; + + @encode(BytesKnownEncoding.base64) + base64?: bytes; + + @encode(BytesKnownEncoding.base64url) + base64url?: bytes; + + @encode("unknown-duration") + unknownDurationFormat?: duration; + + @encode("unknown-datetime") + unknownDateTimeFormat?: utcDateTime; + + @encode("unknown-bytes") + unknownBytes?: bytes; +} + +@@flattenProperty(Fish.properties); +@@flattenProperty(FishProperties.tailProperties); +@@flattenProperty(Fish.anotherProperties); +@@flattenProperty(AnotherFishProperties.eyeProperties); +@@flattenProperty(FunctionProperties.properties); +@@flattenProperty(Result.data); diff --git a/packages/typespec-java/emitter-tests/tsp/arm-versioned.tsp b/packages/typespec-java/emitter-tests/tsp/arm-versioned.tsp new file mode 100644 index 0000000000..413fa7e750 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/arm-versioned.tsp @@ -0,0 +1,59 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.ResourceManager; + +@armProviderNamespace +@service(#{ title: "ArmVersioned" }) +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace TspTest.ArmVersioned; + +enum Versions { + v2023_12_01: "2023-12-01", + v2024_10_01_preview: "2024-10-01-preview", + v2024_12_01: "2024-12-01", +} + +@resource("topLevelArmResources") +model TopLevelArmResource is TrackedResource { + ...ResourceNameParameter; +} + +@doc("Top Level Arm Resource Properties.") +model TopLevelArmResourceProperties { + @visibility(Lifecycle.Read) + provisioningState?: ResourceProvisioningState; +} + +model OpParameters { + @query + parameter?: string; + + @added(Versions.v2024_10_01_preview) + @query + newParameter?: string; +} + +model Response {} + +interface TopLevelArmResources { + createOrUpdate is ArmResourceCreateOrUpdateAsync; + listBySubscription is ArmListBySubscription; + listByResourceGroup is ArmResourceListByParent; + get is ArmResourceRead; + delete is ArmResourceDeleteSync; + action is ArmResourceActionSync< + TopLevelArmResource, + Request = void, + Response = Response, + Parameters = OpParameters + >; +} diff --git a/packages/typespec-java/emitter-tests/tsp/arm.tsp b/packages/typespec-java/emitter-tests/tsp/arm.tsp new file mode 100644 index 0000000000..501cbd428c --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/arm.tsp @@ -0,0 +1,428 @@ +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ClientGenerator.Core; +using Azure.ClientGenerator.Core.Legacy; + +@armProviderNamespace +@service(#{ title: "ArmResource" }) +@versioned(Versions) +@doc("Arm Resource Provider management API.") +namespace TspTest.ArmResourceProvider; + +@doc("Azure API versions.") +enum Versions { + @doc("Preview API version 2022-06-01-preview.") + v2022_06_01_preview: "2022-06-01-preview", + + @doc("Preview API version 2022-09-01-preview.") + v2022_09_01_preview: "2022-09-01-preview", + + @doc("Public API version.") + v2023_11_01: "2023-11-01", + + @doc("Preview API version 2023-12-01-preview.") + v2023_12_01_preview: "2023-12-01-preview", +} + +//----------------------- Child Resources ----------------------- +@doc("Subresource of Top Level Arm Resource.") +@parentResource(TopLevelArmResource) +model ChildResource is TrackedResource { + @key("childResourceName") + @doc("ChildResources") + @visibility(Lifecycle.Read) + @path + @segment("childResources") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +@doc("Child Resource Properties.") +model ChildResourceProperties { + @visibility(Lifecycle.Read) + @doc("Provisioning State of Top Level Arm Resource") + provisioningState?: ProvisioningState; +} + +//----------------------- Top Level Arm Resource ----------------------- +@resource("topLevelArmResources") +model TopLevelArmResource is TrackedResource { + @key("topLevelArmResourceName") + @path + @segment("topLevelArmResources") + @doc("arm resource name for path") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +@doc("Top Level Arm Resource Properties.") +model TopLevelArmResourceProperties { + @doc("Configuration Endpoints.") + @visibility(Lifecycle.Read) + configurationEndpoints?: string[]; + + userName: string; // this should be renamed to username + userNames: string; // this isn't a whole word match, shouldn't be renamed to usernames + accuserName: string; // this isn't a whole word match, shouldn't be renamed to accusername + + @visibility(Lifecycle.Create, Lifecycle.Read) + startTimeStamp: utcDateTime; // this should be renamed to startTimestamp + + @visibility(Lifecycle.Read) + size?: float32; + + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ProvisioningState; +} + +//----------------------- Custom Template Resource ----------------------- +@resource("customTemplateResources") +model CustomTemplateResource is TrackedResource { + @key("customTemplateResourceName") + @path + @segment("customTemplateResources") + @doc("arm resource name for path") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; + + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "https://github.com/Azure/typespec-azure/issues/2840" + @added(Versions.v2023_11_01) + @doc("Managed identity.") + identity?: Azure.ResourceManager.Foundations.ManagedServiceIdentity; +} + +@doc("extensible enum type for discriminator") +union DogKind { + string, + + @doc("Species golden") + Golden: "golden_dog", +} + +@doc("Test extensible enum type for discriminator") +@discriminator("kind") +model Dog { + @doc("discriminator property") + kind: DogKind; + + @doc("Weight of the dog") + weight: int32; +} + +@doc("Golden dog model") +model Golden extends Dog { + @doc("discriminator property") + kind: DogKind.Golden; +} + +@doc("Top Level Arm Resource Properties.") +model CustomTemplateResourceProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ProvisioningState; + + @added(Versions.v2022_06_01_preview) + @removed(Versions.v2023_11_01) + @added(Versions.v2023_12_01_preview) + propertyRemovedInStable: string; + + dog: Dog; + namedEmptyModel: EmptyModel; + anonymousEmptyModel: {}; + priority: PriorityModel; +} + +@doc("Empty model.") +model EmptyModel {} + +model CustomTemplateResourcePatch { + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "https://github.com/Azure/typespec-azure/issues/2840" + @added(Versions.v2023_11_01) + @doc("Managed identity.") + identity?: Azure.ResourceManager.Foundations.ManagedServiceIdentity; + + @added(Versions.v2022_06_01_preview) + @removed(Versions.v2023_11_01) + @added(Versions.v2023_12_01_preview) + propertyRemovedInStable: string; +} + +@lroStatus +union ProvisioningState { + ResourceProvisioningState, + Provisioning: "Provisioning", + Updating: "Updating", + Deleting: "Deleting", + Accepted: "Accepted", +} + +model ResponseWithHeader { + ...OkResponse; + ...Azure.Core.Foundations.RetryAfterHeader; + ...Body; +} + +model Result { + reason?: string; +} + +union PriorityModel { + int32, + HIGH: 0, + LOW: 1, +} + +// #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "built-in conditional request includes time based conditional headers" +alias IfMatchParameters = { + @header("If-Match") + @doc("The request should only proceed if an entity matches this string.") + ifMatch?: string; +}; + +alias IfNoneMatchParameters = { + @header("If-None-Match") + @doc("The request should only proceed if no entity matches this string.") + ifNoneMatch?: string; +}; + +//----------------------- Extension Resource ----------------------- +/** ExtensionResource of Top Level Arm Resource. */ +@parentResource(TopLevelArmResource) +model ChildExtensionResource is ExtensionResource { + @key("childExtensionResourceName") + @doc("ChildExtensionResources") + @visibility(Lifecycle.Read) + @path + @segment("childExtensionResources") + @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") + name: string; +} + +/** Child ExtensionResource properties. */ +model ChildExtensionResourceProperties { + @visibility(Lifecycle.Read) + @doc("Provisioning State of the Resource") + provisioningState?: ProvisioningState; +} + +/** Resource for testing conflict name with operation group. */ +model ManagedMaintenanceWindowStatusContent + is TrackedResource { + ...ResourceNameParameter; +} + +model ManagedMaintenanceWindowStatusContentProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState: string; +} + +model ModelInterfaceDifferentName is TrackedResource { + ...ResourceNameParameter; +} + +model ModelInterfaceDifferentNameProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState: string; +} + +model NginxConfigurationResponse + is Azure.ResourceManager.ProxyResource { + ...ResourceNameParameter< + Resource = NginxConfigurationResponse, + KeyName = "configurationName", + SegmentName = "configurations", + NamePattern = "" + >; +} + +model NginxConfigurationResponseProperties { + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + rootFile?: string; +} + +model NginxConfigurationRequest { + rootFile?: string; +} + +model ChildResourceListResult is Azure.Core.Page; + +@resource("resourceLroNoBody") +model ResourceLroNoBody is TrackedResource { + ...ResourceNameParameter; +} + +model ResourceLroNoBodyProperties { + @visibility(Lifecycle.Read) + @doc("The status of the last operation.") + provisioningState?: ProvisioningState; +} + +// this model should not be generated +model ActionInitiateResult { + status: string; +} + +// this model should be generated +model ActionFinalResult { + result: string; +} + +//----------------------- Paths ----------------------- +@armResourceOperations +interface ChildResourcesInterface + extends ResourceInstanceOperations { + listByTopLevelArmResource is ArmResourceListByParent< + ChildResource, + Response = ArmResponse + >; + actionWithoutBody is ArmResourceActionAsync; +} + +@armResourceOperations +interface TopLevelArmResourceInterface + extends TrackedResourceOperations { + action is ArmResourceActionAsync< + TopLevelArmResource, + void, + Result, + Azure.ResourceManager.Foundations.BaseParameters + >; + + @action("publishxml") + publishXml is ArmResourceActionSync< + TopLevelArmResource, + void, + File<"application/xml", bytes>, + Azure.ResourceManager.Foundations.BaseParameters + >; +} + +@armResourceOperations +interface CustomTemplateResourceInterface + extends ResourceCreate< + CustomTemplateResource, + Azure.ResourceManager.Foundations.BaseParameters & + IfMatchParameters & + IfNoneMatchParameters + > { + @sharedRoute + @added(Versions.v2022_09_01_preview) + @removed(Versions.v2023_11_01) + update is ArmResourceUpdateSync; + + #suppress "@azure-tools/typespec-azure-core/no-operation-id" "Use operationId to keep same name as deprecated update operation" + @sharedRoute + @added(Versions.v2023_11_01) + updateLongRunning is ArmCustomPatchAsync; +} + +interface Operations extends Azure.ResourceManager.Operations {} + +@armResourceOperations +interface ChildExtensionResourceInterface + extends ExtensionResourceOperations {} + +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "This is a valid template" +@autoRoute +@doc("Update a {name}", TResource) +@armResourceCreateOrUpdate(TResource) +@patch +op ArmResourceUpdateSync< + TResource extends Azure.ResourceManager.Foundations.ArmResource, + TBaseParameters = Azure.ResourceManager.Foundations.BaseParameters +>( + ...ResourceInstanceParameters, + + @doc("Resource create parameters.") + @body + resource: TResource, +): ResponseWithHeader | ErrorResponse; + +@armResourceOperations +interface ManagedMaintenanceWindowStatus { + get is ArmResourceRead; + // test renaming delete -> deleteByResourceGroup in fluent method + delete is ArmResourceDeleteAsync< + ManagedMaintenanceWindowStatusContent, + Parameters = IfMatchParameters & + IfNoneMatchParameters + >; +} + +@armResourceOperations +interface ModelInterfaceSameName { + get is ArmResourceRead; + // test renaming deleteWithResponse -> deleteByResourceGroupWithResponse in fluent method + delete is ArmResourceDeleteSync< + ModelInterfaceDifferentName, + Parameters = IfMatchParameters & + IfNoneMatchParameters + >; +} + +// Resource model is immutable output only. +@armResourceOperations +interface ImmutableResourceModel { + @put + createOrUpdate is Azure.ResourceManager.Legacy.UpdateOperation< + ResourceInstanceParameters< + NginxConfigurationResponse, + Azure.ResourceManager.Foundations.DefaultBaseParameters + >, + NginxConfigurationRequest, + | NginxConfigurationResponse + | ArmResourceCreatedResponse< + NginxConfigurationResponse, + LroHeaders = ArmAsyncOperationHeader + >, + ErrorResponse, + OptionalRequestBody = true + >; +} + +// LRO without body in response +@armResourceOperations +interface LroNoBody { + @put + createOrUpdate is Azure.ResourceManager.Legacy.CreateOrReplaceAsync< + ResourceLroNoBody, + Request = ResourceLroNoBody, + Response = ArmAcceptedLroResponse & + Azure.Core.Foundations.RetryAfterHeader> + >; + + @post + action is ArmResourceActionAsync< + ResourceLroNoBody, + void, + ActionInitiateResult, + LroHeaders = ArmCombinedLroHeaders & + Azure.Core.Foundations.RetryAfterHeader + >; +} + +// client configure +@@clientName(TspTest.ArmResourceProvider, "ArmClient"); +@@clientName(ManagedMaintenanceWindowStatusContent, "ManagedMaintenanceWindowStatus"); +@@clientName(ModelInterfaceDifferentName, "ModelInterfaceSameName"); +@@flattenProperty(TrackedResource.properties); +@@flattenProperty(Azure.ResourceManager.Foundations.ResourceUpdateModel.properties); diff --git a/packages/typespec-java/emitter-tests/tsp/builtin.tsp b/packages/typespec-java/emitter-tests/tsp/builtin.tsp new file mode 100644 index 0000000000..a7e2ae798b --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/builtin.tsp @@ -0,0 +1,97 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Builtin" }) +namespace TspTest.Builtin; + +model Builtin { + boolean: boolean; + string: string; + bytes: bytes; + int: int32; + safeint: safeint; + decimal: decimal; + long: int64; + float: float32; + double: float64; + duration: duration; + date: plainDate; + dateTime: utcDateTime; + stringList: string[]; + bytesDict: Record; + url: url; + nullableFloatDict: Record; + encoded: Encoded; + uuid: Azure.Core.uuid; +} + +@encode(DurationKnownEncoding.seconds, float32) +scalar myDuration extends duration; + +model Encoded { + @encode(DurationKnownEncoding.seconds, int32) + timeInSeconds?: duration; + + timeInSecondsFraction?: myDuration; + + @encode(DateTimeKnownEncoding.rfc3339) + dateTime?: utcDateTime; + + @encode(DateTimeKnownEncoding.rfc7231) + dateTimeRfc7231?: utcDateTime; + + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + unixTimestamp?: utcDateTime; + + @encode(BytesKnownEncoding.base64) + base64?: bytes; + + @encode(BytesKnownEncoding.base64url) + base64url?: bytes; + + @encode("unknown-duration") + unknownDurationFormat?: duration; + + @encode("unknown-datetime") + unknownDateTimeFormat?: utcDateTime; + + @encode("unknown-bytes") + unknownBytes?: bytes; + + @encode(ArrayEncoding.commaDelimited) + commaDeliminatedArray?: string[]; +} + +model Request { + @header("x-ms-date") + dateTime?: utcDateTime; + + @query + filter?: string; + + @query("query") + queryParam: string; + + @query("query-encoded") + queryParamEncoded: url; + + @query("query-opt") + queryParamOptional?: string; + + @query("query-opt-encoded") + queryParamOptionalEncoded?: url; +} + +@route("/builtin") +interface BuiltinOp { + read(...Request): { + @body body: Builtin; + }; + + @post + write(@body body: Builtin): OkResponse; +} diff --git a/packages/typespec-java/emitter-tests/tsp/client-option.tsp b/packages/typespec-java/emitter-tests/tsp/client-option.tsp new file mode 100644 index 0000000000..8ccf91ff35 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/client-option.tsp @@ -0,0 +1,29 @@ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "ClientOption" }) +namespace TspTest.ClientOption; + +alias ClientRequiredParameters = { + @header accept?: "application/json;odata.metadata=minimal"; + @query filter: string; +}; + +model ClientRequiredRequest { + name: string; + timespan?: duration; +} + +@route("/client-required") +interface ClientRequired { + @post + post(...ClientRequiredParameters, @body body: ClientRequiredRequest): {}; +} + +@@clientOption(ClientRequiredParameters.accept, "clientRequired", true, "java"); +@@clientOption(ClientRequiredRequest.timespan, "clientRequired", true, "java"); diff --git a/packages/typespec-java/emitter-tests/tsp/discriminator-edge-cases.tsp b/packages/typespec-java/emitter-tests/tsp/discriminator-edge-cases.tsp new file mode 100644 index 0000000000..bb8982abd9 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/discriminator-edge-cases.tsp @@ -0,0 +1,65 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.Core; +using Azure.ClientGenerator.Core; + +@service(#{ title: "DiscriminatorEdgeCases" }) +namespace TspTest.DiscriminatorEdgeCases; + +model ParentWithRequiredProperty { + discriminator: string; + aProperty: string; +} + +@discriminator("discriminator") +model ChildWithRequiredPropertyAsDiscriminator extends ParentWithRequiredProperty { + anotherProperty: string; +} + +@discriminator("differentDiscriminator") +model ChildWithAnotherDiscriminator extends ParentWithRequiredProperty { + yetAnotherProperty: string; +} + +model GrandChildWithRequiredProperty extends ChildWithRequiredPropertyAsDiscriminator { + discriminator: "aValue"; +} + +model GrandChildWithAnotherDiscriminator extends ChildWithAnotherDiscriminator { + differentDiscriminator: "anotherValue"; +} + +/** Model with @discriminator but no known subtypes. */ +@discriminator("kind") +model ModelWithDiscriminatorNoSubtypes { + kind: string; + name: string; +} + +@client({ + service: TspTest.DiscriminatorEdgeCases, + name: "DiscriminatorEdgeCasesClient", +}) +@route("/model") +interface DiscriminatorEdgeCasesOp { + @get + @route("/childrequireddiscrim") + getChildRequiredDiscrim(): { + @body body: ChildWithRequiredPropertyAsDiscriminator; + }; + + @get + @route("/childnewdiscrim") + getChildNewDiscrim(): { + @body body: ChildWithAnotherDiscriminator; + }; + + @get + @route("/nosubtypes") + getNoSubtypes(): { + @body body: ModelWithDiscriminatorNoSubtypes; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/enum.tsp b/packages/typespec-java/emitter-tests/tsp/enum.tsp new file mode 100644 index 0000000000..8545bfbc2b --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/enum.tsp @@ -0,0 +1,213 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "EnumService" }) +namespace TspTest.EnumService; + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +enum Color { + Red, + Blue, + Green, +} + +union ColorModel { + ColorModelBase, + Blue: "Blue", + Green: "Green", +} + +union ColorModelBase { + string, + Red: "Red", +} + +@access(Access.public) +@usage(Usage.input | Usage.output) +union PriorityModel { + int32, + High: 100, + Low: 0, +} + +union OlympicRecordModel { + float32, + Olympic_100_Meters: 9.58, + Olympic_200_Meters: 19.30, +} + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +enum Priority { + High: 100, + Low: 0, +} + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +enum Unit { + Grams: 1, + KiloGrams: 0.001, + Milligram: 1000, +} + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +enum OperationStateValues { + Running, + Completed, + Failed, +} + +@usage(Usage.input) +model Operation { + name: "Read" | "Write"; + best: true; + age: 50; + priority: Priority; + color: ColorModel; + unit: Unit; + priorityValue: Priority.Low; + colorValue: Color.Green; + colorModelValue: ColorModel.Blue; + unitValue?: Unit.Milligram; + olympicRecord?: OlympicRecordModel; + olympicRecordValue?: OlympicRecordModel.Olympic_100_Meters; +} + +@client({ + service: TspTest.EnumService, + name: "EnumServiceClient", +}) +@route("/enum") +interface EnumOp { + @get + @route("/color") + getColor(): { + @header contentType: "application/json"; + @body body: Color; + }; + + @get + @route("/colormodel") + getColorModel(): { + @header contentType: "application/json"; + @body body: ColorModel; + }; + + @post + @route("operation/colormodel") + setColorModel(@query color: ColorModel): Operation; + + @post + @route("operation/priority") + setPriority(@query priority: Priority): Operation; + + @get + @route("operation/state/running") + getRunningOperation(@query state: "Running"): Operation; + + @get + @route("operation/state") + getOperation(@query state: OperationStateValues): Operation; + + @post + @route("operation/stringenumarray") + setStringEnumArray( + @query + colorArray: ColorModel[], + + @query + colorArrayOpt?: ColorModel[], + ): string; + + @post + @route("operation/intenumarray") + setIntEnumArray( + @query + @encode("ssv") + priorityArray: Priority[], + + @query + priorityArrayOpt?: Priority[], + ): void; + + @post + @route("operation/stringarray") + setStringArray( + @query + stringArray: string[], + + @query + stringArrayOpt?: string[], + ): void; + + @post + @route("operation/intarray") + setIntArray( + @query + intArray: int32[], + + @query + intArrayOpt?: int32[], + ): void; + + @post + @route("operation/stringenummulti") + setStringEnumMulti( + @query(#{ explode: true }) + colorArray: ColorModel[], + + @query(#{ explode: true }) + colorArrayOpt?: ColorModel[], + ): void; + + @post + @route("operation/intenummulti") + setIntEnumMulti( + @query(#{ explode: true }) + priorityArray: Priority[], + + @query(#{ explode: true }) + priorityArrayOpt?: Priority[], + ): void; + + @post + @route("operation/stringmulti") + setStringMulti( + @query(#{ explode: true }) + stringArray: string[], + + @query(#{ explode: true }) + stringArrayOpt?: string[], + ): void; + + @post + @route("operation/intmulti") + setIntMulti( + @query(#{ explode: true }) + intArray: int32[], + + @query(#{ explode: true }) + intArrayOpt?: int32[], + ): void; + + @post + @route("operation/stringenumarrayheader") + setStringEnumArrayHeader( + @header + colorArray: ColorModel[], + + @header + colorArrayOpt?: ColorModel[], + ): void; + + // The request and response should be `@header contentType: "application/json", @body body: ColorModel` + // The test here is to make sure the generated code still compile pass, even if it is not the expected operation definition. + @post + @route("operation/wrong-body") + getWrongBody(@body body: ColorModelBase): { + @body body: ColorModelBase; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/error.tsp b/packages/typespec-java/emitter-tests/tsp/error.tsp new file mode 100644 index 0000000000..cea55ef90d --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/error.tsp @@ -0,0 +1,54 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; + +using TypeSpec.Http; +using TypeSpec.Versioning; +using Azure.Core.Foundations; + +@service(#{ title: "ErrorModel" }) +namespace TspTest.ErrorModel; + +model Diagnostic { + name: string; + error: Error; + subError: SubError; +} + +model SubError extends Error { + subCode: string; +} + +// BatchError, BatchErrorException is generated, on use-default-http-status-code-to-exception-type-mapping=false +@error +model BatchError { + code?: string; + message?: BatchErrorMessage; +} + +model BatchErrorMessage { + lang?: string; + value?: string; +} + +// BadResponseError, BadResponseErrorException is generated, on use-default-http-status-code-to-exception-type-mapping=false +@error +model BadResponseError is Response<400> { + code: string; + data: Details; +} + +model Details { + name: string; +} + +@error +model NotFoundErrorResponse is NotFoundResponse; + +@route("/error") +interface ErrorOp { + read(): + | ResourceCreatedOrOkResponse + | NotFoundErrorResponse + | BadResponseError + | BatchError; +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/EtagHeaders_ListWithEtag.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/EtagHeaders_ListWithEtag.json new file mode 100644 index 0000000000..8a6e4f31d1 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/EtagHeaders_ListWithEtag.json @@ -0,0 +1,24 @@ +{ + "operationId": "EtagHeaders_ListWithEtag", + "title": "Etag headers ListWithEtag", + "parameters": { + "api-version": "2022-06-01-preview" + }, + "responses": { + "200": { + "headers": { + "ETag": "\"64e005\"" + }, + "body": { + "value": [ + { + "id": "myId", + "name": "name", + "type": "myType", + "description": "This is sample for Etag headers" + } + ] + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/EtagHeaders_PutWithRequestHeaders.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/EtagHeaders_PutWithRequestHeaders.json new file mode 100644 index 0000000000..e72511369f --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/EtagHeaders_PutWithRequestHeaders.json @@ -0,0 +1,36 @@ +{ + "operationId": "EtagHeaders_PutWithRequestHeaders", + "title": "Etag headers PutWithRequestHeaders", + "parameters": { + "api-version": "2022-06-01-preview", + "name": "name", + "If-Match": "\"64e005\"", + "resource": { + "type": "myType", + "description": "This is sample for Etag headers" + } + }, + "responses": { + "200": { + "headers": { + "ETag": "\"64e005\"" + }, + "body": { + "id": "myId", + "name": "name", + "type": "myType", + "description": "This is sample for Etag headers" + } + }, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/FlattenOp_Send.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/FlattenOp_Send.json new file mode 100644 index 0000000000..b1deb995e7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/FlattenOp_Send.json @@ -0,0 +1,28 @@ +{ + "operationId": "FlattenOp_Send", + "title": "FlattenOp Send", + "parameters": { + "id": "myRequiredId", + "maxpagesize": 50, + "sendRequest": { + "user": { + "user": "myOptionalUser" + }, + "input": "myRequiredInput", + "constant": "constant" + } + }, + "responses": { + "200": {}, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/FlattenOp_SendLong.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/FlattenOp_SendLong.json new file mode 100644 index 0000000000..0947db2e64 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/FlattenOp_SendLong.json @@ -0,0 +1,35 @@ +{ + "operationId": "FlattenOp_SendLong", + "title": "FlattenOp SendLong", + "parameters": { + "name": "myRequiredId", + "filter": "name=myName", + "body": { + "user": { + "user": "myOptionalUser" + }, + "input": "myRequiredInput", + "dataInt": 11, + "dataIntOptional": 12, + "dataLong": 13, + "data_float": 14.0, + "title": "title", + "description": "description", + "status": "NotStarted", + "constant": "constant" + } + }, + "responses": { + "200": {}, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/LongRunning_CreateJob.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/LongRunning_CreateJob.json new file mode 100644 index 0000000000..1e4a1eddd6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/LongRunning_CreateJob.json @@ -0,0 +1,31 @@ +{ + "operationId": "CreateJob", + "title": "LongRunning CreateJob", + "parameters": { + "body": { + "configuration": "{}", + "nullableFloatDict": { + "max": 15.0, + "min": 14.0, + "average": 14.3 + } + } + }, + "responses": { + "202": { + "headers": { + "Operation-Location": "https://www.example.org" + } + }, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/ResponseOp_Exists.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/ResponseOp_Exists.json new file mode 100644 index 0000000000..f7264f475f --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/ResponseOp_Exists.json @@ -0,0 +1,20 @@ +{ + "operationId": "ResponseOp_Exists", + "title": "ResponseOp Exists", + "parameters": { + "api-version": "2022-06-01-preview" + }, + "responses": { + "200": {}, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/ResponseOp_ListStrings.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/ResponseOp_ListStrings.json new file mode 100644 index 0000000000..4782aa4702 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-06-01-preview/ResponseOp_ListStrings.json @@ -0,0 +1,20 @@ +{ + "operationId": "ResponseOp_ListStrings", + "title": "ResponseOp ListStrings", + "parameters": { + "api-version": "2022-06-01-preview" + }, + "responses": { + "200": ["a", "b", "c"], + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2022-09-01/VersioningOp_List.json b/packages/typespec-java/emitter-tests/tsp/examples/2022-09-01/VersioningOp_List.json new file mode 100644 index 0000000000..955aea64c3 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2022-09-01/VersioningOp_List.json @@ -0,0 +1,31 @@ +{ + "operationId": "VersioningOp_List", + "title": "VersioningOp List", + "parameters": { + "filter": "age gt 18", + "select": ["name=name"] + }, + "responses": { + "200": { + "body": { + "value": [ + { + "id": "myId", + "name": "name", + "type": "type" + } + ] + } + }, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2023-12-01-preview/TopLevelArmResourceInterface_Action.json b/packages/typespec-java/emitter-tests/tsp/examples/2023-12-01-preview/TopLevelArmResourceInterface_Action.json new file mode 100644 index 0000000000..62b7e8eff6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2023-12-01-preview/TopLevelArmResourceInterface_Action.json @@ -0,0 +1,16 @@ +{ + "operationId": "TopLevelArmResourceInterface_Post", + "title": "TopLevelArmResourceInterface Action", + "parameters": { + "resourceGroupName": "resource-group-name", + "topLevelArmResourceName": "resource-name", + "api-version": "2023-12-01-preview" + }, + "responses": { + "200": { + "body": { + "reason": "action" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/2024-12-01/TopLevelArmResources_Get.json b/packages/typespec-java/emitter-tests/tsp/examples/2024-12-01/TopLevelArmResources_Get.json new file mode 100644 index 0000000000..83eefd53ba --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/2024-12-01/TopLevelArmResources_Get.json @@ -0,0 +1,24 @@ +{ + "operationId": "TopLevelArmResources_Get", + "title": "TopLevelArmResources Get", + "parameters": { + "resourceGroupName": "resource-group-name", + "topLevelArmResourcePropertiesName": "resource-name", + "api-version": "2024-12-01", + "parameter": "parameter-value", + "newParameter": "new-parameter-value" + }, + "responses": { + "200": { + "body": { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/TspTest.ArmVersioned/topLevelArmResources/resource-name", + "name": "resource-name", + "type": "TspTest.ArmVersioned/topLevelArmResources", + "location": "eastus", + "properties": { + "provisioningState": "Succeeded" + } + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/BuiltinOp_Read.json b/packages/typespec-java/emitter-tests/tsp/examples/BuiltinOp_Read.json new file mode 100644 index 0000000000..3d2808c0b4 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/BuiltinOp_Read.json @@ -0,0 +1,49 @@ +{ + "operationId": "BuiltinOp_Read", + "title": "BuiltinOp Read", + "parameters": { + "filter": "myFilter" + }, + "responses": { + "200": { + "body": { + "boolean": true, + "string": "myString", + "safeint": 32, + "long": 64, + "float": 32.0, + "double": 64.0, + "duration": "PT15M", + "date": "2023-08-29", + "dateTime": "2019-10-12T07:20:50.520Z", + "nullableFloatDict": { + "max": 15.0, + "min": 14.0, + "average": 14.3 + }, + "url": "https://www.github.com", + "stringList": ["a", "b", "c"], + "encoded": { + "timeInSeconds": "900", + "timeInSecondsFraction": "1200.345", + "dateTime": "1966-03-03T00:06:56.52Z", + "dateTimeRfc7231": "Sun, 06 Nov 1994 08:49:37 GMT", + "unixTimestamp": "1693362903", + "base64": "aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==", + "base64url": "aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==", + "commaDeliminatedArray": "a,b,c" + } + } + }, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/BuiltinOp_Write.json b/packages/typespec-java/emitter-tests/tsp/examples/BuiltinOp_Write.json new file mode 100644 index 0000000000..11dbdce71e --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/BuiltinOp_Write.json @@ -0,0 +1,48 @@ +{ + "operationId": "BuiltinOp_Write", + "title": "BuiltinOp Write", + "parameters": { + "body": { + "boolean": true, + "string": "myString", + "safeint": 32, + "long": 64, + "float": 32.0, + "double": 64.0, + "duration": "PT15M", + "date": "2023-08-29", + "dateTime": "2019-10-12T07:20:50.520Z", + "nullableFloatDict": { + "max": 15.0, + "min": 14.0, + "average": 14.3 + }, + "url": "https://www.github.com", + "stringList": ["a", "b", "c"], + "encoded": { + "timeInSeconds": "900", + "timeInSecondsFraction": "1200.345", + "dateTime": "1966-03-03T00:06:56.52Z", + "dateTimeRfc7231": "Sun, 06 Nov 1994 08:49:37 GMT", + "unixTimestamp": "1693362903", + "base64": "aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==", + "base64url": "aHR0cHM6Ly93d3cuZ2l0aHViLmNvbQ==", + "commaDeliminatedArray": "a,b,c" + } + } + }, + "responses": { + "200": { + }, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/ModelOp_PutNested.json b/packages/typespec-java/emitter-tests/tsp/examples/ModelOp_PutNested.json new file mode 100644 index 0000000000..e73bb44c69 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/ModelOp_PutNested.json @@ -0,0 +1,32 @@ +{ + "operationId": "ModelOp_PutNested", + "title": "ModelOp PutNested", + "parameters": { + "nested1": { + "nested2": { + "data": "123" + } + } + }, + "responses": { + "200": { + "body": { + "nested1": { + "nested2": { + "data": "123" + } + } + } + }, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/examples/SingleContentType_uploadImageForSingleContentType.json b/packages/typespec-java/emitter-tests/tsp/examples/SingleContentType_uploadImageForSingleContentType.json new file mode 100644 index 0000000000..d28cc29305 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/examples/SingleContentType_uploadImageForSingleContentType.json @@ -0,0 +1,20 @@ +{ + "operationId": "SingleContentType_UploadImageForSingleContentType", + "title": "SingleContentType UploadImageForSingleContentType", + "parameters": { + "data": "\"D:\\Program Files\"" + }, + "responses": { + "200": {}, + "default": { + "headers": { + "Content-Type": "application/json", + "x-ms-error-code": "Error Code" + }, + "body": { + "code": "Error Code", + "message": "Error Message" + } + } + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/external.tsp b/packages/typespec-java/emitter-tests/tsp/external.tsp new file mode 100644 index 0000000000..c7479347ca --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/external.tsp @@ -0,0 +1,69 @@ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "External" }) +namespace TspTest.External; + +union CloudEventDataFormat { + string, + "BYTES", + "JSON", +} + +@doc("Days of the week for recurrence schedule.") +union DayOfWeek { + string, + + @doc("Sunday.") + Sunday: "Sunday", + + @doc("Monday.") + Monday: "Monday", + + @doc("Tuesday.") + Tuesday: "Tuesday", + + @doc("Wednesday.") + Wednesday: "Wednesday", + + @doc("Thursday.") + Thursday: "Thursday", + + @doc("Friday.") + Friday: "Friday", + + @doc("Saturday.") + Saturday: "Saturday", +} + +model Body { + cloudEventDataFormat?: CloudEventDataFormat; + dayOfWeek?: DayOfWeek; +} + +@route("/external") +interface ExternalOp { + @post + postExternal(@body body: Body): Body; +} + +@@alternateType( + CloudEventDataFormat, + { + identity: "com.azure.core.models.CloudEventDataFormat", + }, + "java" +); + +@@alternateType( + DayOfWeek, + { + identity: "java.time.DayOfWeek", + }, + "java" +); diff --git a/packages/typespec-java/emitter-tests/tsp/flatten.tsp b/packages/typespec-java/emitter-tests/tsp/flatten.tsp new file mode 100644 index 0000000000..09b2c5d69b --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/flatten.tsp @@ -0,0 +1,150 @@ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Versioning; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Flatten" }) +@server( + "{endpoint}/openai", + "Flatten", + { + endpoint: string, + } +) +@versioned(ServiceApiVersions) +namespace TspTest.Flatten; + +enum ServiceApiVersions { + v2022_06_01_preview: "2022-06-01-preview", +} + +@doc("The ApiVersion query parameter.") +model ApiVersionParameter { + @query("api-version") + @minLength(1) + @doc("The API version to use for this operation.") + apiVersion: string; +} + +alias Request = { + @visibility(Lifecycle.Read) @key name: string; + endpoint: string; + user?: User; + input: string; + constant: "constant"; + requiredInt: int32; +}; + +alias LongRequest = { + user?: User; + input: string; + dataInt: int32; + dataIntOptional?: int32; + dataLong?: int64; + requiredUser: User; + + @clientName("dataFloat") + @encodedName("application/json", "data_float") + float?: float64; + + // reserved keyword + long?: int64; +}; + +model User { + user: string; +} + +model TodoItem { + /** The item's unique id */ + @visibility(Lifecycle.Read) @key id: safeint; + + /** The item's title */ + @maxLength(255) + title: string; + + /** A longer description of the todo item in markdown format */ + description?: string; + + /** The status of the todo item */ + status: "NotStarted" | "InProgress" | "Completed"; + + /** When the todo item was created. */ + @visibility(Lifecycle.Read) createdAt: utcDateTime; + + /** When the todo item was last updated */ + @visibility(Lifecycle.Read) updatedAt: utcDateTime; + + /** When the todo item was makred as completed */ + @visibility(Lifecycle.Read) completedAt?: utcDateTime; + + // hack to get a different schema for create + // (fastify glue doesn't support readonly) + @visibility(Lifecycle.Create) _dummy?: string; +} + +model TodoItemPatch { + /** The item's title */ + title?: TodoItem.title; + + /** A longer description of the todo item in markdown format */ + description?: TodoItem.description | null; + + /** The status of the todo item */ + status?: "NotStarted" | "InProgress" | "Completed"; +} + +@client({ + service: TspTest.Flatten, + name: "FlattenClient", +}) +@route("/flatten") +interface FlattenOp { + @route("send") + @post + send( + @query id: string, + @query maxpagesize?: int32, + @query constantQueryParam: "constant", + ...Request, + ...ApiVersionParameter, + ): OkResponse; + + @route("send-projected-name") + @post + sendProjectedName( + @query id: string, + + @encodedName("application/json", "file_id") + @clientName("fileIdentifier") + fileId: string, + ): OkResponse; + + @route("send-long") + @post + sendLong( + @query name: string, + @query filter?: string, + ...LongRequest, + ...TodoItem, + constant: "constant", + ...ApiVersionParameter, + ): OkResponse; + + @route("patch/{id}") + @patch + update( + @header contentType: "application/merge-patch+json", + @path id: TodoItem.id, + patch: TodoItemPatch, + ): { + @body response: TodoItem; + }; + + @route("optional-body") + @post + sendOptionalBody(name?: string): OkResponse; +} diff --git a/packages/typespec-java/emitter-tests/tsp/internal.tsp b/packages/typespec-java/emitter-tests/tsp/internal.tsp new file mode 100644 index 0000000000..3b6723b30e --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/internal.tsp @@ -0,0 +1,108 @@ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Internal" }) +namespace TspTest.Internal; + +// ApiRequest and RequestInner will be generated +@access(Access.public) +model ApiRequest { + property: RequestInner; +} + +model RequestInner { + name: string; +} + +// ResponseInternal and ResponseInternalInner will be generated in implementation.models package +model ResponseInternal { + property: ResponseInternalInner; +} + +@access(Access.public, "python") +model ResponseInternalInner { + name: string; +} + +// Response will be generated as output-only +@access(Access.public) +model ApiResponse { + name: string; +} + +// StandAloneData will be generated as output +@access(Access.public) +@usage(Usage.output, "java") +model StandAloneData { + property: StandAloneDataInner; +} + +// StandAloneDataInner will be generated as intput + output +@usage(Usage.input | Usage.output, "!python") +model StandAloneDataInner { + name: string; +} + +// StandAloneUnion will be generated in implementation.models package +@access(Access.internal) +model StandAloneUnion { + data: url | bytes; +} + +// Color and ColorModel will be generated in implementation.models package +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +@access(Access.internal) +@usage(Usage.input | Usage.output) +enum Color { + Red, + Blue, + Green, +} + +@access(Access.internal) +@usage(Usage.input | Usage.output) +union ColorModel { + string, + "Red", + "Blue", + "Green", +} + +// UnusedEnum will be generated +@access(Access.public) +@usage(Usage.input | Usage.output) +union UnusedEnum { + string, + "Weekday", + "Weekend", +} + +// ProtocolInternalModel will not be generated, as the model is not used in convenient API +model ProtocolInternalModel { + name: string; +} + +@route("/internal") +interface InternalOp { + // test ApiRequest with Access.public + @access(Access.public, "!python") + @access(Access.internal, "java") + @post + postInternal(@body body: ApiRequest): ResponseInternal; + + // test ApiResponse with Access.public + @get + @access(Access.internal, "python, java") + getInternal(): ApiResponse; + + @route("/protocal-internal") + @post + @access(Access.internal) + @convenientAPI(false) + postProtocalInternal(@body body: ProtocolInternalModel): void; +} diff --git a/packages/typespec-java/emitter-tests/tsp/literal.tsp b/packages/typespec-java/emitter-tests/tsp/literal.tsp new file mode 100644 index 0000000000..2df14d0067 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/literal.tsp @@ -0,0 +1,28 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; + +using TypeSpec.Http; +using Azure.Core; + +@service(#{ title: "LiteralService" }) +namespace TspTest.LiteralService; + +model Model { + literal: "literal"; + optionalLiteral?: "optionalLiteral"; +} + +alias Request = { + @query + literalParam: "literalParam"; + + @query + optionalLiteralParam?: "optionalLiteralParam"; +}; + +@route("/literal") +interface LiteralOp { + @put + @route("/put") + put(...Request, @body body: Model): Model; +} diff --git a/packages/typespec-java/emitter-tests/tsp/lro.tsp b/packages/typespec-java/emitter-tests/tsp/lro.tsp new file mode 100644 index 0000000000..04d361face --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/lro.tsp @@ -0,0 +1,128 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Rest; +using TypeSpec.Http; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; +using Azure.ClientGenerator.Core; + +@service(#{ title: "LongRunning" }) +@versioned(ApiVersions) +@route("/long-running") +namespace TspTest.LongRunning { + enum ApiVersions { + v2022_06_01_preview: "2022-06-01-preview", + } + + // case of LRO having pollingOperation in non-service namespace + @pollingOperation(NonService.poll) + @post + @route("/post") + op longRunning(): AcceptedResponse; + + model PollResponse { + operationId: string; + status: Azure.Core.Foundations.OperationState; + } + + // case of HealthInsights + @route("/jobs/{id}") + op getJob is LroLongRunningPollOperation; + + @pollingOperation(LongRunning.getJob) + @route("/jobs") + op createJob is LroLongRunningRpcOperation< + { + @body body: JobData; + }, + JobResult + >; + + model JobData { + configuration?: string; + nullableFloatDict: Record; + } + + model JobResult + is LroOperationStatus<{ + data: string; + }>; + + @lroStatus + union JobStatus { + string, + NotStarted: "notStarted", + Running: "running", + Succeeded: "Succeeded", + Failed: "Failed", + Canceled: "canceled", + } + + model LroOperationStatus { + @key("operationId") + @visibility(Lifecycle.Read) + id: Azure.Core.uuid; + + @visibility(Lifecycle.Read) + @lroStatus + status: JobStatus; + + @visibility(Lifecycle.Read) + createdDateTime?: utcDateTime; + + @visibility(Lifecycle.Read) + expirationDateTime?: utcDateTime; + + @visibility(Lifecycle.Read) + lastUpdateDateTime?: utcDateTime; + + error?: TStatusError; + result?: TStatusResult; + } + + op LroLongRunningRpcOperation< + TParams extends TypeSpec.Reflection.Model, + TResponse extends TypeSpec.Reflection.Model, + Traits extends {} = {} + > is Azure.Core.RpcOperation< + TParams & RepeatabilityRequestHeaders, + Foundations.AcceptedResponse & + Foundations.RetryAfterHeader> & + RepeatabilityResponseHeaders & + LroOperationStatus, + Traits + >; + + op LroLongRunningPollOperation is Azure.Core.RpcOperation< + { + @path("id") + id: Azure.Core.uuid; + }, + TResult, + LroRetryAfterTrait + >; + + model LroLongRunningStatusLocation { + @pollingLocation + @TypeSpec.Http.header("Operation-Location") + operationLocation: LroResourceLocation>; + } + + scalar LroResourceLocation extends url; + + @trait("LroRetryAfterTrait") + model LroRetryAfterTrait { + retryAfter: { + @traitLocation(TraitLocation.Response) + response: Foundations.RetryAfterHeader; + }; + } +} + +namespace TspTest.NonService { + @route("/poll") + @get + op poll(): TspTest.LongRunning.PollResponse; +} diff --git a/packages/typespec-java/emitter-tests/tsp/method-override.tsp b/packages/typespec-java/emitter-tests/tsp/method-override.tsp new file mode 100644 index 0000000000..2b86adb76f --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/method-override.tsp @@ -0,0 +1,141 @@ +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/http"; +import "@typespec/rest"; +import "@typespec/versioning"; + +using global.Azure.Core.Foundations; +using Azure.ClientGenerator.Core; +using TypeSpec.Http; +using TypeSpec.Versioning; + +@service(#{ title: "MethodOverride" }) +@versioned(Versions) +namespace TspTest.MethodOverride { + enum Versions { + v2022_12_01_preview: "2022-12-01-preview", + } + + model GroupQueryOptions { + @query foo?: string; + @query bar?: string; + } + + @get + @route("/group-query") + op groupQuery is global.Azure.Core.RpcOperation; + + model GroupAllOptions { + @query foo?: string; + @query bar?: string; + prop1: string; + prop2?: string; + } + + @post + @route("/group-all") + op groupAll is global.Azure.Core.RpcOperation; + + alias GroupPartNotGrouped = { + @query foo?: string; + prop1: string; + }; + + model GroupPartOptions { + @query bar?: string; + prop2?: string; + } + + @post + @route("/group-part") + op groupPart is global.Azure.Core.RpcOperation; + + model GroupPartETagOptions { + ...GroupPartOptions; + + @header("If-Modified-Since") + ifModifiedSince?: utcDateTime; + + @header("If-Unmodified-Since") + ifUnmodifiedSince?: utcDateTime; + + @header("If-Match") + ifMatch?: string; + + @header("If-None-Match") + ifNoneMatch?: string; + } + + @post + @route("/group-part-etag") + op groupPartETag is global.Azure.Core.RpcOperation< + GroupPartNotGrouped & GroupPartETagOptions, + {} + >; + + model GroupExcludeBodyModel { + prop1: string; + prop2?: string; + } + + alias GroupExcludeBody = { + @body body: GroupExcludeBodyModel; + }; + + @post + @route("/group-exclude-body") + op groupExcludeBody is global.Azure.Core.RpcOperation; + + alias GroupNoneNotGrouped = { + @query foo?: string; + @header bar?: string; + prop1: string; + prop2?: string; + prop3?: string; + prop4?: string; + prop5?: string; + prop6?: string; + }; + + @post + @route("/group-none") + op groupNone is global.Azure.Core.RpcOperation; +} + +// customization in client.tsp +namespace Customization { + op groupQueryCustomization( + options?: TspTest.MethodOverride.GroupQueryOptions, + ...ApiVersionParameter, + ): void; + op groupAllCustomization( + options: TspTest.MethodOverride.GroupAllOptions, + ...ApiVersionParameter, + ): void; + op groupPartCustomization( + ...TspTest.MethodOverride.GroupPartNotGrouped, + options?: TspTest.MethodOverride.GroupPartOptions, + ...ApiVersionParameter, + ): void; + op groupPartETagCustomization( + ...TspTest.MethodOverride.GroupPartNotGrouped, + options?: TspTest.MethodOverride.GroupPartETagOptions, + ...ApiVersionParameter, + ): void; + op groupExcludeBodyCustomization( + ...TspTest.MethodOverride.GroupExcludeBody, + options?: TspTest.MethodOverride.GroupQueryOptions, + ...ApiVersionParameter, + ): void; + op groupNoneCustomization( + ...TspTest.MethodOverride.GroupNoneNotGrouped, + ...ApiVersionParameter, + ): void; + + @@override(TspTest.MethodOverride.groupQuery, Customization.groupQueryCustomization); + @@override(TspTest.MethodOverride.groupAll, Customization.groupAllCustomization); + @@override(TspTest.MethodOverride.groupPart, Customization.groupPartCustomization); + @@override(TspTest.MethodOverride.groupPartETag, Customization.groupPartETagCustomization); + @@override(TspTest.MethodOverride.groupExcludeBody, Customization.groupExcludeBodyCustomization); + @@override(TspTest.MethodOverride.groupNone, Customization.groupNoneCustomization); +} diff --git a/packages/typespec-java/emitter-tests/tsp/model.tsp b/packages/typespec-java/emitter-tests/tsp/model.tsp new file mode 100644 index 0000000000..7e35c55b95 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/model.tsp @@ -0,0 +1,79 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; + +@service(#{ title: "Model" }) +namespace TspTest.Model; + +// input-output +model Resource1 { + name: string; + + @visibility(Lifecycle.Read) + outputData: OutputData; + + @visibility(Lifecycle.Read) + outputData2: InputOutputData2; +} + +// input-output +model Resource2 { + name: string; + data2: InputOutputData2; +} + +// output +model Resource3 { + name: string; + outputData3: OutputData3; +} + +// output +model OutputData { + data: string; +} + +// input-output, due to Resource2 +model InputOutputData2 { + data: string; +} + +// output +model OutputData3 { + data: string; +} + +// root model +model NestedModel { + nested1: NestedModel1; +} + +// nested level1 +model NestedModel1 { + nested2: NestedModel2; +} + +// nested level2 +model NestedModel2 { + data: string; +} + +@route("/model") +interface ModelOp { + @put + @route("/resource1") + put1(@body body: Resource1): Resource1; + + @put + @route("/resource2") + put2(@body body: Resource2): Resource2; + + @get + @route("/resource3") + get3(): Resource3; + + @get + @route("/nested") + putNested(@body body: NestedModel): NestedModel; +} diff --git a/packages/typespec-java/emitter-tests/tsp/multipart.tsp b/packages/typespec-java/emitter-tests/tsp/multipart.tsp new file mode 100644 index 0000000000..1dd89274b6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/multipart.tsp @@ -0,0 +1,63 @@ +import "@typespec/http"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Multipart" }) +namespace TspTest.Multipart; + +union ImageType { + string, + "JPEG", + "PNG", +} + +model Size { + width: int32; + height: int32; +} + +model FormData { + name: HttpPart; + resolution: HttpPart; + type: HttpPart; + size: HttpPart; + image: HttpPart; + fileData?: HttpPart[]; +} + +@route("/upload/images/{name}") +@post +op upload( + @path name: string, + @query compress?: boolean, + @header contentType: "multipart/form-data", + @multipartBody data: FormData, +): OkResponse; + +model Inherit1File extends File { + contentType?: string; + filename: string; +} + +/** + * Image file of content-type "image/jpeg" + */ +@clientName("InheritFileData") +model Inherit2File extends Inherit1File { + contentType: "image/jpeg"; +} + +@route("/uploadHttpPart/images/{name}") +@post +op uploadHttpPart( + @path name: string, + @query compress?: boolean, + @header contentType: "multipart/form-data", + @multipartBody body: { + fileData1: HttpPart; + fileData2: HttpPart; + size: HttpPart; + }, +): OkResponse; diff --git a/packages/typespec-java/emitter-tests/tsp/multiple-content-types.tsp b/packages/typespec-java/emitter-tests/tsp/multiple-content-types.tsp new file mode 100644 index 0000000000..150c54f5bd --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/multiple-content-types.tsp @@ -0,0 +1,139 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "MultiContentTypes" }) +namespace TspTest.MultiContentTypes; + +model Resource { + @visibility(Lifecycle.Read) + id: string; + + @key + @visibility(Lifecycle.Read) + name: string; +} + +@route("/single/request") +interface SingleContentType { + @doc("response is binary") + @route("/download/image") + @get + downloadImageForSingleContentType(): OkResponse & { + @header("content-type") contentType: "image/png"; + @body data: bytes; + }; + + @doc("request is binary") + @route("/upload/image") + @post + uploadImageForSingleContentType(@body data: bytes, @header contentType: "image/png"): void; +} + +@route("multiple/sharedroute/request") +interface MultipleContentTypesOnRequest { + @doc("one data type maps to multiple content types") + @route("upload/single-body-type") + @post + uploadBytesWithSingleBodyTypeForMultiContentTypes( + @body data: bytes, + @header contentType: + | "application/octet-stream" + | "image/jpeg" + | "image/png" + | "application/json-patch+json", + ): void; + + @doc("multiple data types map to multiple content types using shared route") + @route("upload/multi-body-types") + @sharedRoute + @post + uploadBytesWithMultiBodyTypesForMultiContentTypes( + @body data: bytes, + @header contentType: "application/octet-stream" | "image/jpeg" | "image/png", + ): void; + + @doc("multiple data types map to multiple content types using shared route") + @route("upload/multi-body-types") + @sharedRoute + @post + uploadJsonWithMultiBodyTypesForMultiContentTypes( + @body data: Resource, + @header contentType: "application/json", + ): void; + + @doc("multiple data types map to multiple content types using shared route") + @route("upload/multi-body-types") + @sharedRoute + @post + uploadJsonOrBytesWithMultiBodyTypesForMultiContentTypes( + @body data: bytes | Resource, + @header contentType: + | "application/json" + | "application/octet-stream" + | "image/jpeg" + | "image/png", + ): void; +} + +// @route("multiple/sharedroute/response") +// interface MultipleContentTypesOnResponse { +// @doc("multiple content types map to one response type") +// @route("upload/single-response-type") +// @post +// uploadBytesWithSingleResponseTypeForMultiContentTypes(@body data: bytes, @header contentType: "application/octet-stream" | "image/jpeg" | "image/png"): bytes; + +// @doc("multiple content types map to multiple response types using shared route") +// @route("upload/multi-response-types") +// @sharedRoute +// @post +// uploadIntOrResourceWithMultiResponseTypesForMultiContentTypes(@body data: Resource | int32, @header contentType: "application/octet-stream" | "application/json"): Resource | int32; + +// @doc("multiple data types map to multiple content types using shared route") +// @route("upload/multi-response-types") +// @sharedRoute +// @post +// uploadResourceWithSingleBodyTypesForMultiContentTypes(@body data: Resource, @header contentType: "application/json"): Resource; + +// } + +// overload +@doc("multiple data types map to multiple content types") +@route("upload/overload/multi-body-types") +@post +op uploadWithOverload( + @body data: string | bytes | Resource, + @header contentType: + | "text/plain" + | "application/json" + | "application/octet-stream" + | "image/jpeg" + | "image/png", +): void; + +@doc("multiple data types map to multiple content types") +@route("upload/overload/multi-body-types") +@post +@overload(uploadWithOverload) +op uploadStringWithOverload(@body data: string, @header contentType: "text/plain"): void; + +@doc("multiple data types map to multiple content types using `@overload`") +@route("upload/overload/multi-body-types") +@post +@overload(uploadWithOverload) +op uploadImagesWithOverload( + @body data: bytes, + @header contentType: "image/jpeg" | "image/png", +): void; + +@doc("multiple data types map to multiple content types using `@overload`") +@route("upload/overload/multi-body-types") +@post +@overload(uploadWithOverload) +op uploadBytesOrJsonWithOverload( + @body data: bytes | Resource, + @header contentType: "application/octet-stream" | "image/jpeg" | "image/png" | "application/json", +): void; diff --git a/packages/typespec-java/emitter-tests/tsp/namespace.tsp b/packages/typespec-java/emitter-tests/tsp/namespace.tsp new file mode 100644 index 0000000000..282f80d933 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/namespace.tsp @@ -0,0 +1,19 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.Core; +using Azure.Core.Foundations; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Namespace" }) +namespace TspTest.NamespaceClient { + op get(): TspTest.NamespaceModel.Model; +} + +namespace TspTest.NamespaceModel { + model Model { + name: string; + } +} diff --git a/packages/typespec-java/emitter-tests/tsp/naming-javaparser.tsp b/packages/typespec-java/emitter-tests/tsp/naming-javaparser.tsp new file mode 100644 index 0000000000..2125af3306 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/naming-javaparser.tsp @@ -0,0 +1,130 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.Core; +using Azure.Core.Foundations; +using Azure.ClientGenerator.Core; + +@summary("summary of Naming JavaParser") +@doc("description of Naming JavaParser") +@service(#{ title: "Naming JavaParser" }) +namespace TspTest.NamingJavaParser; + +@summary("summary of Response") +@doc("description of Response. Include tab ' ' in doc.") +@friendlyName("DataResponse") +model Response { + @summary("summary of name property") + @doc("description of name property") + name: string; + + @summary("summary of data property") + @doc("description of data property") + data: DataModel; + + @summary("summary of type property") + @doc("description of type property") + @friendlyName("dataType") + type: TypesModel; + + @summary("summary of status property") + @doc("description of status property") + status: StatusModel; + + anonymous: RunObject; +} + +model RunObject { + last_error: + | { + code: "server_error" | "rate_limit_exceeded" | "invalid_prompt"; + } + | null; +} + +@summary("summary of Data") +@doc("description of Data") +@friendlyName("BinaryData") +model DataModel { + @summary("summary of data property") + @doc("description of data property") + data: Data; +} + +// "@" should be escaped +@doc("Dummy doc to make the javadoc break at the 'at' symbol. The type of the Data depends on @data.kind.letusmakeitlongsoitwouldbreakbeforethis field") +@discriminator("kind") +model Data { + // "@" should be escaped + @clientName("type") + @encodedName("application/json", "@data.kind") + kind: string; +} + +model BytesData extends Data { + @clientName("type") + @encodedName("application/json", "@data.kind") + kind: "bytes"; + + // "{@code}" should not be escaped + @doc("Data as {@code byte[]}") + @clientName("dataAsBytes") + @encodedName("application/json", "data_bytes") + data: bytes; +} + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +@summary("summary of Types") +@doc("description of Types") +enum TypesModel { + Blob, + File, +} + +@summary("summary of Statuses") +@doc("description of Statuses") +@friendlyName("DataStatus") +union StatusModel { + string, + + @clientName("LroRunning") + Running: "Running", + + Completed: "Completed", + Failed: "Failed", +} + +@summary("summary of Request") +@doc("description of Request") +@friendlyName("DataRequest") +model Request { + @summary("summary of name query parameter") + @doc("description of name query parameter") + @query + name: string; + + @header + @summary("summary of etag header parameter") + @doc("description of etag header parameter") + etag?: string; + + parameters?: { + type: "Type1" | "Type2"; + }; +} + +@summary("summary of naming route") +@doc("description of naming route") +@route("/naming") +interface NamingOp { + @summary("summary of POST op") + @doc("description of POST op") + @post + post(@bodyRoot body: Request): Response | ErrorResponse; + + getAnonymous(): { + name: string; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/naming.tsp b/packages/typespec-java/emitter-tests/tsp/naming.tsp new file mode 100644 index 0000000000..2f6da90f66 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/naming.tsp @@ -0,0 +1,133 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.Core; +using Azure.Core.Foundations; +using Azure.ClientGenerator.Core; + +@summary("summary of Naming") +@doc("description of Naming") +@service(#{ title: "Naming" }) +namespace TspTest.Naming; + +@summary("summary of Response") +@doc("description of Response. Include tab ' ' in doc.") +@friendlyName("DataResponse") +model Response { + @summary("summary of name property") + @doc("description of name property") + name: string; + + @summary("summary of data property") + @doc("description of data property") + data: DataModel; + + @summary("summary of type property") + @doc("description of type property") + @friendlyName("dataType") + type: TypesModel; + + @summary("summary of status property") + @doc("description of status property") + status: StatusModel; + + @doc("The domain\\username data") + domainUsername: string; + + anonymous: RunObject; +} + +model RunObject { + last_error: + | { + code: "server_error" | "rate_limit_exceeded" | "invalid_prompt"; + } + | null; +} + +@summary("summary of Data") +@doc("description of Data") +@friendlyName("BinaryData") +model DataModel { + @summary("summary of data property") + @doc("description of data property") + data: Data; +} + +// "@" should be escaped +@doc("Dummy doc to make the javadoc break at the 'at' symbol. The type of the Data depends on @data.kind.letusmakeitlongsoitwouldbreakbeforethis field") +@discriminator("kind") +model Data { + // "@" should be escaped + @clientName("type") + @encodedName("application/json", "@data.kind") + kind: string; +} + +model BytesData extends Data { + @clientName("type") + @encodedName("application/json", "@data.kind") + kind: "bytes"; + + // "{@code}" should not be escaped + @doc("Data as {@code byte[]}") + @clientName("dataAsBytes") + @encodedName("application/json", "data_bytes") + data: bytes; +} + +#suppress "@azure-tools/typespec-azure-core/use-extensible-enum" "For testing" +@summary("summary of Types") +@doc("description of Types") +enum TypesModel { + Blob, + File, +} + +@summary("summary of Statuses") +@doc("description of Statuses") +@friendlyName("DataStatus") +union StatusModel { + string, + + @clientName("LroRunning") + Running: "Running", + + Completed: "Completed", + Failed: "Failed", +} + +@summary("summary of Request") +@doc("description of Request") +@friendlyName("DataRequest") +model Request { + @summary("summary of name query parameter") + @doc("description of name query parameter") + @query + name: string; + + @header + @summary("summary of etag header parameter") + @doc("description of etag header parameter") + etag?: string; + + parameters?: { + type: "Type1" | "Type2"; + }; +} + +@summary("summary of naming route") +@doc("description of naming route") +@route("/naming") +interface NamingOp { + @summary("summary of POST op") + @doc("description of POST op") + @post + post(@bodyRoot body: Request): Response | ErrorResponse; + + getAnonymous(): { + name: string; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/nested-enum-discriminator.tsp b/packages/typespec-java/emitter-tests/tsp/nested-enum-discriminator.tsp new file mode 100644 index 0000000000..077c08f967 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/nested-enum-discriminator.tsp @@ -0,0 +1,88 @@ +import "@typespec/http"; + +using TypeSpec.Http; + +@doc("Illustrates multiple level inheritance with multiple enum discriminators.") +@service(#{ title: "EnumNestedDiscriminator" }) +@route("/type/model/inheritance/enum-nested-discriminator") +namespace TspTest.EnumNestedDiscriminator; + +@doc("extensible enum type for discriminator") +union FishKind { + string, + + @doc("The kind of fish is shark.") + Shark: "shark", + + @doc("The kind of fish is salmon.") + Salmon: "salmon", +} + +@doc("This is base model for polymorphic multiple levels inheritance with a discriminator.") +@discriminator("kind") +model Fish { + @doc("discriminator property") + kind: FishKind; + + age: int32; +} + +@doc("extensible enum type for discriminator") +union SharkKind { + string, + + @doc("The kind of shark is saw.") + Saw: "saw", + + @doc("The kind of shark is goblin.") + Goblin: "goblin", +} + +@doc("The second level model in polymorphic multiple levels inheritance and it defines a new discriminator.") +@discriminator("sharktype") +model Shark extends Fish { + kind: FishKind.Shark; + sharktype: SharkKind; +} + +@doc("The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic instances.") +model Salmon extends Fish { + kind: FishKind.Salmon; + friends?: Fish[]; + hate?: Record; + partner?: Fish; +} + +@doc("The third level model SawShark in polymorphic multiple levels inheritance.") +model SawShark extends Shark { + sharktype: SharkKind.Saw; +} + +@doc("The third level model GoblinShark in polymorphic multiple levels inheritance.") +model GoblinShark extends Shark { + sharktype: SharkKind.Goblin; +} + +@route("/model") +@get +op getModel(): Fish; + +@route("/model") +@put +op putModel(@body input: Fish): NoContentResponse; + +@route("/recursivemodel") +@get +op getRecursiveModel(): Fish; + +@route("/recursivemodel") +@put +op putRecursiveModel(@body input: Fish): NoContentResponse; + +@route("/missingdiscriminator") +@get +op getMissingDiscriminator(): Fish; + +@route("/wrongdiscriminator") +@get +op getWrongDiscriminator(): Fish; diff --git a/packages/typespec-java/emitter-tests/tsp/optional.tsp b/packages/typespec-java/emitter-tests/tsp/optional.tsp new file mode 100644 index 0000000000..24436d7a02 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/optional.tsp @@ -0,0 +1,67 @@ +import "@typespec/rest"; + +using TypeSpec.Http; + +@service(#{ title: "Optional" }) +namespace TspTest.Optional; + +model Optional { + boolean?: boolean = true; + booleanNullable?: boolean | null; + booleanRequired: boolean; + booleanRequiredNullable: boolean | null; + string?: string; + stringNullable?: string | null; + stringRequired: string; + stringRequiredNullable: string | null; + bytes?: bytes; + int?: int32; + long?: int64; + float?: float32; + double?: float64; + duration?: duration; + dateTime?: utcDateTime; + stringList?: string[]; + bytesDict?: Record; + + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + epochDateTimeRequiredNullable: utcDateTime | null; + + @encode(DateTimeKnownEncoding.unixTimestamp, int64) + epochDateTimeNullable?: utcDateTime; +} + +model Immutable { + stringReadWriteRequired: string; + + @visibility(Lifecycle.Read) + stringReadOnlyOptional?: string; +} + +@withOptionalProperties +model AllPropertiesOptional { + ...Optional; + immutable: Immutable; +} + +@route("/optional") +interface OptionalOp { + @put + @route("/put") + put( + @header requestHeaderRequired: string, + @header requestHeaderOptional?: string = "test-header", + @query booleanRequired: boolean, + @query booleanNullable?: boolean | null, + @query booleanRequiredNullable: boolean | null, + @query string?: string, + @query stringNullable?: string | null, + @query stringRequired: string, + @query stringRequiredNullable: string | null, + @body Optional?: Optional, + ): { + @header headerRequired: string; + @header headerOptional?: string; + @body body?: AllPropertiesOptional; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/partialupdate.tsp b/packages/typespec-java/emitter-tests/tsp/partialupdate.tsp new file mode 100644 index 0000000000..775b8f5ebf --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/partialupdate.tsp @@ -0,0 +1,33 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "PartialUpdate" }) +namespace TspTest.PartialUpdate; + +model PartialUpdateModel { + boolean: boolean; + string: string; + bytes: bytes; + + @doc(""" + The aggregation function to be applied on the client metric. Allowed functions + - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, + ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + ‘count’ - for requests + """) + aggregate?: string; +} + +@client({ + service: TspTest.PartialUpdate, + name: "PartialUpdateClient", +}) +@route("/partialupdate") +interface PartialUpdateOp { + read(): { + @body body: PartialUpdateModel; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/patch.tsp b/packages/typespec-java/emitter-tests/tsp/patch.tsp new file mode 100644 index 0000000000..839e37f3f7 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/patch.tsp @@ -0,0 +1,107 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; +import "@typespec/versioning"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using Azure.Core; +using Azure.ClientGenerator.Core; +using TypeSpec.Versioning; + +@service(#{ title: "Patch" }) +namespace TspTest.Patch; + +@resource("resources") +model Resource { + @visibility(Lifecycle.Read) + id: string; + + @key + @visibility(Lifecycle.Read) + name: string; + + description?: string; + map: Record; + longValue?: int64; + intValue?: int32; + enumValue?: "a" | "b" | "c"; + + @encodedName("application/json", "wireNameForInnerModelProperty") + innerModelProperty?: InnerModel; + + array?: InnerModel[]; + fish?: Fish; +} + +model InnerModel { + name: string; + description?: string; +} + +@doc("This is base model for polymorphic multiple levels inheritance with a discriminator.") +@discriminator("kind") +@resource("resources") +model Fish { + @visibility(Lifecycle.Read) + id: string; + + @key + @visibility(Lifecycle.Read) + name: string; + + age: int32; + color?: string; +} + +@doc("The second level model in polymorphic multiple levels inheritance and it defines a new discriminator.") +@discriminator("sharktype") +model Shark extends Fish { + kind: "shark"; + sharktype: string; + weight?: int32; +} + +@doc("The third level model SawShark in polymorphic multiple levels inheritance.") +model SawShark extends Shark { + sharktype: "saw"; +} + +@doc("The second level model in polymorphic multiple levels inheritance which contains references to other polymorphic instances.") +model Salmon extends Fish { + kind: "salmon"; + friends?: Fish[]; + hate?: Record; + partner?: Fish; +} + +@route("/patch") +interface Patch { + @patch + @route("/resource") + createOrUpdateResource( + @header("content-type") contentType: "application/merge-patch+json", + @body resource: Resource, + ): Resource; + + @patch + @route("/resource/optional") + createOrUpdateOptionalResource( + @header("content-type") contentType: "application/merge-patch+json", + @body resource?: Resource, + ): Resource; + + @patch + @route("/fish") + createOrUpdateFish( + @header("content-type") contentType: "application/merge-patch+json", + @body fish: Fish, + ): Fish; + + @patch + @route("/fish/salmon") + createOrUpdateSalmon( + @header("content-type") contentType: "application/merge-patch+json", + @body fish: Salmon, + ): Salmon; +} diff --git a/packages/typespec-java/emitter-tests/tsp/protocol-api-convenient-api.tsp b/packages/typespec-java/emitter-tests/tsp/protocol-api-convenient-api.tsp new file mode 100644 index 0000000000..be1d6ca59d --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/protocol-api-convenient-api.tsp @@ -0,0 +1,157 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-client-generator-core"; +import "@azure-tools/typespec-azure-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Foundations; +using Azure.Core.Traits; +using Azure.ClientGenerator.Core; + +@service(#{ title: "ProtocolAndConvenient" }) +@versioned(ApiVersions) +namespace TspTest.ProtocolAndConvenient; + +enum ApiVersions { + v2022_06_01_preview: "2022-06-01-preview", +} + +model ResourceA { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +model ResourceB { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +model ResourceC { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +model ResourceD { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +model ResourceE { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +model ResourceF { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +model ResourceG { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +model ResourceH { + @visibility(Lifecycle.Read) + id: string; + + name: string; +} + +@resource("resources") +model ResourceI { + @visibility(Lifecycle.Read) + id: string; + + @visibility(Lifecycle.Read) + @key + name: string; + + type: string; +} + +@resource("resources") +model ResourceJ { + @visibility(Lifecycle.Read) + id: string; + + @visibility(Lifecycle.Read) + @key + name: string; + + type: string; +} + +@trait +model ListTrait { + @traitContext(TraitContext.List) + request: { + @traitLocation(TraitLocation.Parameters) + properties: { + @clientName("maxPageSize") + @query + maxresults?: safeint; + }; + }; +} + +interface ResourceOperations + extends Azure.Core.ResourceOperations {} + +@route("protocolandconvenient") +interface ProtocolAndConvenienceOp { + @doc("When set protocol false and convenient true, then the protocol method should be package private") + @route("onlyConvenient") + @post + @convenientAPI(true) + @protocolAPI(false) + onlyConvenient(@body body: ResourceA): ResourceB; + + @doc("When set protocol true and convenient false, only the protocol method should be generated, ResourceC and ResourceD should not be generated") + @route("onlyProtocol") + @post + @convenientAPI(false) + @protocolAPI(true) + onlyProtocol(@body body: ResourceC): ResourceD; + + @doc("Setting protocol true and convenient true, both convenient and protocol methods will be generated") + @route("bothConvenientAndProtocol") + @post + @convenientAPI(true) + @protocolAPI(true) + bothConvenientAndProtocol(@body body: ResourceE): ResourceF; + + @doc("When set protocol false and convenient false") + @route("errorSetting") + @post + @convenientAPI(false) + @protocolAPI(false) + errorSetting(@body body: ResourceG): ResourceH; + + @doc("Long running operation") + @pollingOperation(ResourceOperations.GetResourceOperationStatus) + @protocolAPI(false) + createOrReplace is ResourceOperations.LongRunningResourceCreateOrReplace; + + @doc("Paging operation") + @protocolAPI(false) + list is ResourceOperations.ResourceList; +} diff --git a/packages/typespec-java/emitter-tests/tsp/response.tsp b/packages/typespec-java/emitter-tests/tsp/response.tsp new file mode 100644 index 0000000000..d2918bc3a6 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/response.tsp @@ -0,0 +1,260 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Response" }) +@versioned(ApiVersions) +namespace TspTest.Response; + +enum ApiVersions { + v2022_06_01_preview: "2022-06-01-preview", +} + +@Foundations.Private.needsRoute +op RpcOperationWithAdditionalResponse< + TParams, + TResponse extends TypeSpec.Reflection.Model, + TAdditionalResponse extends {}, + Traits extends {} = {}, + TErrorResponse = Azure.Core.Foundations.ErrorResponse +> is Foundations.Operation< + TParams & Azure.Core.Traits.Private.TraitProperties, + | (TResponse & Azure.Core.Traits.Private.TraitProperties) + | TAdditionalResponse, + Traits, + TErrorResponse +>; + +@resource("resources") +model Resource { + @visibility(Lifecycle.Read) + id: string; + + @key + @visibility(Lifecycle.Read) + name: string; + + description?: string; + type: string; +} + +model ResourceArray is Resource[]; + +// no "id" property +model OperationDetails1 { + @doc("Operation ID") + @key + @visibility(Lifecycle.Create, Lifecycle.Read) + operationId: uuid; + + status: Azure.Core.Foundations.OperationState; + error?: Azure.Core.Foundations.Error; + + @lroResult + result?: Resource; +} + +// no "result" property +model OperationDetails2 { + @doc("Operation ID") + @key + @visibility(Lifecycle.Create, Lifecycle.Read) + id: uuid; + + status: Azure.Core.Foundations.OperationState; + error?: Azure.Core.Foundations.Error; + + @lroResult + @clientName("longRunningResult", "java") + @encodedName("application/json", "lro_result") + lroResult?: Resource; +} + +model StringsList { + @pageItems + @clientName("items", "java") + @encodedName("application/json", "items_value") + value: string[]; + + @nextLink + @clientName("nextLink", "java") + @encodedName("application/json", "next_link") + next?: string; +} + +model Int32sList { + @pageItems + value: int32[]; +} + +model DateTimesList { + @pageItems + value: utcDateTime[]; +} + +op CustomLongRunningOperation< + TParams extends TypeSpec.Reflection.Model, + TResponse extends TypeSpec.Reflection.Model +> is Foundations.Operation< + TParams, + AcceptedResponse & { + @pollingLocation + @header("Operation-Location") + operationLocation: ResourceLocation; + } +>; + +@Azure.ClientGenerator.Core.client({ + name: "ResponseClient", + service: TspTest.Response, +}) +@doc("Response") +@route("/response") +interface ResponseOp { + // file as BinaryData + @route("/get-binary") + @get + getBinary(): OkResponse & { + @header("content-type") contentType: "image/png"; + @body body: bytes; + }; + + @route("/get-array") + getArray(): ResourceArray; + + @route("/get-another-array") + getAnotherArray(): ResourceArray; + + // response with headers + @route("/create-with-headers") + @put + createWithHeaders(): CreatedResponse & { + @header("operation-location") + operationLocation: ResourceLocation; + + @body + body: Resource; + }; + + @route("/delete-with-headers") + @delete + deleteWithHeaders(): NoContentResponse & { + @header("operation-location") + operationLocation: ResourceLocation; + }; + + // expect boolean response, true for 200, false for 404 + @route("/exists") + @head + exists is RpcOperationWithAdditionalResponse< + {}, + { + @doc("A response containing headers related to the Job Schedule, if it exists.") + @statusCode + code: "200"; + }, + { + @doc("A response containing headers related to the Job Schedule, if it exists.") + @statusCode + code: "404"; + }, + {}, + Foundations.ErrorResponse + >; + + // OperationDetails does not have "id" property + // expect final result be OperationDetails1, as the response does not follow the standard + @route("/lro-invalid-poll-response") + lroInvalidPollResponse is CustomLongRunningOperation< + { + @body request: Resource; + }, + OperationDetails1 + >; + + // OperationDetails does not have "result" property + // expect final result be OperationDetails2, as the response does not follow the standard + @route("/lro-invalid-result") + lroInvalidResult is CustomLongRunningOperation< + { + @body request: Resource; + }, + OperationDetails2 + >; + + @route("/paged-string") + @list + listStrings(): StringsList; + + @route("/paged-int32") + @list + listIntegers(): Int32sList; + + // @route("/paged-datetime") + // @list + // listDateTimes(): DateTimesList; + + @route("/json-utf8-response") + getJsonUtf8Response(): Resource & { + @header contentType: "application/json;charset=utf-8"; + }; + + // expect same method signature as "application/json" + @route("/plus-json-response") + getPlusJsonResponse(): Resource & { + @header contentType: "application/vnd.microsoft.appconfig.kv+json"; + }; + + // expect BinaryData as response + @route("/union-response") + getUnionResponse(): OperationDetails1 | OperationDetails2; + + @route("/text-boolean-response") + @get + getTextBoolean(): OkResponse & { + @body body: boolean; + }; + + @route("/text-byte-response") + @get + getTextByte(): OkResponse & { + @body body: int8; + }; + + @route("/text-int32-response") + @get + getTextInt32(): OkResponse & { + @body body: int32; + }; + + @route("/text-int64-response") + @get + getTextInt64(): OkResponse & { + @body body: int64; + }; + + @route("/text-float32-response") + @get + getTextFloat32(): OkResponse & { + @body body: float32; + }; + + @route("/text-float64-response") + @get + getTextFloat64(): OkResponse & { + @body body: float64; + }; + + @route("/text-char-response") + @get + getTextChar(): OkResponse & { + @body body: int16; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/special-chars.tsp b/packages/typespec-java/emitter-tests/tsp/special-chars.tsp new file mode 100644 index 0000000000..93b61f8704 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/special-chars.tsp @@ -0,0 +1,38 @@ +import "@typespec/rest"; + +using TypeSpec.Http; + +@service(#{ title: "SpecialChars" }) +namespace TspTest.SpecialChars; + +model Resource { + @doc("id") + id: string; + + @doc(""" + The aggregation function to be applied on the client metric. Allowed functions + - ‘percentage’ - for error metric , ‘avg’, ‘p50’, ‘p90’, ‘p95’, ‘p99’, ‘min’, + ‘max’ - for response_time_ms and latency metric, ‘avg’ - for requests_per_sec, + ‘count’ - for requests + """) + aggregate?: string; + + @doc("The comparison operator. Supported types ‘>’, ‘<’ ") + condition?: string; + + @doc("Request name for which the Pass fail criteria has to be applied ") + requestName?: string; + + @doc(""" + The value to compare with the client metric. Allowed values - ‘error : [0.0 , + 100.0] unit- % ’, response_time_ms and latency : any integer value unit- ms. + """) + value?: float32; +} + +@route("/specialchars") +interface BuiltinOp { + read(id: string): { + @body body: Resource; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/special-headers.tsp b/packages/typespec-java/emitter-tests/tsp/special-headers.tsp new file mode 100644 index 0000000000..6d2f81b05b --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/special-headers.tsp @@ -0,0 +1,112 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; + +@service(#{ title: "SpecialHeaders" }) +@versioned(ApiVersions) +namespace TspTest.SpecialHeaders; + +enum ApiVersions { + v2022_06_01_preview: "2022-06-01-preview", +} + +@resource("resources") +model Resource { + @visibility(Lifecycle.Read) + id: string; + + @key + @visibility(Lifecycle.Read) + name: string; + + description?: string; + type: string; +} + +interface ResourceOperations + extends Azure.Core.ResourceOperations {} + +interface StandardResourceOperations + extends Azure.Core.ResourceOperations {} + +@route("/repeatability-headers") +interface RepeatabilityHeaders { + @get + get is ResourceOperations.ResourceRead; + + @put + @doc("Send a put request with header Repeatability-Request-ID and Repeatability-First-Sent") + put is ResourceOperations.ResourceCreateOrReplace; + + @post + @doc("Send a post request with header Repeatability-Request-ID and Repeatability-First-Sent") + post is ResourceOperations.ResourceAction; + + @doc("Send a LRO request with header Repeatability-Request-ID and Repeatability-First-Sent") + createLro is ResourceOperations.LongRunningResourceCreateOrUpdate; +} + +@route("/etag-headers") +interface EtagHeaders { + @put + putWithRequestHeaders is StandardResourceOperations.ResourceCreateOrReplace< + Resource, + RequestHeadersTrait & ResponseHeadersTrait + >; + + @patch + patchWithMatchHeaders is StandardResourceOperations.ResourceCreateOrUpdate< + Resource, + RequestHeadersTrait<{ + @header("If-Match") + @doc("The request should only proceed if an entity matches this string.") + ifMatch?: string; + + @header("If-None-Match") + @doc("The request should only proceed if no entity matches this string.") + ifNoneMatch?: string; + }> & + ResponseHeadersTrait + >; + + @get + listWithEtag is StandardResourceOperations.ResourceList< + Resource, + ResponseHeadersTrait + >; +} + +@route("/etag-headers-optional-body") +interface EtagHeadersOptionalBody { + @put + @doc("etag headers among other optional query/header/body parameters") + putWithOptionalBody( + @query format: string, + @query filter?: string, + ...ConditionalRequestHeaders, + @header @encode(DateTimeKnownEncoding.unixTimestamp, int64) timestamp?: utcDateTime, + @body body?: Resource, + ): Resource; +} + +@route("/skip-special-headers") +interface SkipSpecialHeaders { + @doc("skip special headers") + deleteWithSpecialHeaders is StandardResourceOperations.ResourceDelete< + Resource, + RequestHeadersTrait<{ + @header("client-request-id") clientRequestId: string; + @header("return-client-request-id") returnClientRequestId: boolean; + @header foo: string; + }> + >; +} diff --git a/packages/typespec-java/emitter-tests/tsp/subclass.tsp b/packages/typespec-java/emitter-tests/tsp/subclass.tsp new file mode 100644 index 0000000000..8f76d84f82 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/subclass.tsp @@ -0,0 +1,58 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; + +@service(#{ title: "Subclass" }) +namespace TspTest.Subclass; + +model DuplicateRequiredPropertyParent { + @encodedName("application/json", "property") + requiredProperty: string; + + duplicateRequiredProperty: string; +} +model DuplicateRequiredProperty extends DuplicateRequiredPropertyParent { + @encodedName("application/json", "duplicateRequiredProperty") + newRequiredProperty: string; +} + +model PropertyChangedToRequiredParent { + propertyChangedToRequired?: string; +} +model PropertyChangedToRequired extends PropertyChangedToRequiredParent { + propertyChangedToRequired: string; +} + +model PropertyChangedToConstantParent { + propertyChangedToConstant: string; +} +model PropertyChangedToConstant extends PropertyChangedToConstantParent { + propertyChangedToConstant: "constantValue"; +} + +// Incompatible return type in Java method override +// model PropertyChangedToEnumParent { +// propertyChangedToEnum: string; +// } +// model PropertyChangedToEnum extends PropertyChangedToEnumParent { +// propertyChangedToEnum: EnumModel; +// } +// union EnumModel { +// string, +// "value1", +// } + +model Body { + duplicateRequiredProperty?: DuplicateRequiredProperty; + propertyChangedToRequired?: PropertyChangedToRequired; + propertyChangedToConstant?: PropertyChangedToConstant; +} + +@route("/subclass") +interface Subclass { + @post + @route("/property-in-subclass") + propertyInSubclass(@body body: Body): Body; +} diff --git a/packages/typespec-java/emitter-tests/tsp/subclient.tsp b/packages/typespec-java/emitter-tests/tsp/subclient.tsp new file mode 100644 index 0000000000..b255ff4b64 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/subclient.tsp @@ -0,0 +1,29 @@ +import "@typespec/http"; +import "@typespec/spector"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Spector; +using Azure.ClientGenerator.Core; + +/** + * Describe client with `@clientInitialization` + */ +@scenarioService("/client/initialization/basic") +@scenario +@scenarioDoc(""" + Testing that "SubClient" be initialized with "name" client property, + and that the "action" API under "SubClient" does not take "name" parameter in method signature. + """) +namespace TspTest.ClientInitialization; + +model SubClientOptions { + name: string; +} + +@clientInitialization(SubClientOptions) +interface SubClient { + @post + @route("/sub-client/{name}:action") + action(@path name: string, @query type: string): void; +} diff --git a/packages/typespec-java/emitter-tests/tsp/union.tsp b/packages/typespec-java/emitter-tests/tsp/union.tsp new file mode 100644 index 0000000000..c118451363 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/union.tsp @@ -0,0 +1,99 @@ +import "@typespec/rest"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Traits; +using Azure.Core.Foundations; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Union" }) +@server( + "{endpoint}/openai", + "Union", + { + endpoint: string, + } +) +@versioned(ServiceApiVersions) +namespace TspTest.Union; + +enum ServiceApiVersions { + v2022_03_01_preview: "2022-03-01-preview", + v2022_06_01_preview: "2022-06-01-preview", +} + +@doc("The ApiVersion query parameter.") +model ApiVersionParameter { + @query("api-version") + @minLength(1) + @doc("The API version to use for this operation.") + apiVersion: string; +} + +alias Request = { + user?: User; + input: string | string[] | integer[] | integer[][]; +}; + +alias LongRequest = { + user?: User; + input: string; + dataInt: int32; + dataUnion?: string | ArrayData | bytes | utcDateTime; + dataLong?: int64; + data_float?: float64; +}; + +model User { + user: string; +} + +model ArrayData { + data: string[]; +} + +@usage(Usage.input | Usage.output) +model Result { + name: string; + result?: Result; + data: bytes | Result; +} + +model Query { + @query + data?: url | bytes; +} + +@access(Access.internal) +@usage(Usage.input | Usage.output) +model SubResult extends Result { + text?: string; + arrayData?: bytes | ArrayData; +} + +@route("/union") +interface UnionFlattenOp { + @route("send") + @post + send(@query id: string, ...Request, ...ApiVersionParameter): OkResponse; + + @route("send-long") + @post + sendLong( + @query id: string, + @query filter?: string, + ...LongRequest, + ...ApiVersionParameter, + ): OkResponse; + + @route("param") + @get + get(...Query): OkResponse; + + @route("generate") + generate is LongRunningRpcOperation<{}, OperationStatus, Result>; +} diff --git a/packages/typespec-java/emitter-tests/tsp/versioning.tsp b/packages/typespec-java/emitter-tests/tsp/versioning.tsp new file mode 100644 index 0000000000..bcdecd7d0c --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/versioning.tsp @@ -0,0 +1,99 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Azure.Core; +using Azure.Core.Foundations; +using Azure.Core.Traits; + +@service(#{ title: "Versioning" }) +@versioned(ApiVersions) +namespace TspTest.Versioning; + +enum ApiVersions { + v2022_06_01_preview: "2022-06-01-preview", + v2022_09_01: "2022-09-01", + v2022_12_01_preview: "2022-12-01-preview", +} + +@resource("resources") +model Resource { + @visibility(Lifecycle.Read) + id: string; + + @key + @visibility(Lifecycle.Read) + name: string; + + type: string; +} + +model ExportedResource { + id: string; + + @added(ApiVersions.v2022_09_01) + resourceUri: string; + + @removed(ApiVersions.v2022_09_01) + name: string; + + @removed(ApiVersions.v2022_09_01) + @added(ApiVersions.v2022_12_01_preview) + type: string; +} + +model ExportParams { + @query + projectFileVersion?: string; + + @added(ApiVersions.v2022_12_01_preview) + @query + projectedFileFormat?: string; + + @removed(ApiVersions.v2022_09_01) + @query + removedQueryParam?: string; + + @removed(ApiVersions.v2022_09_01) + @added(ApiVersions.v2022_12_01_preview) + @query + maxLines?: int32; +} + +model ListQueryParams { + ...SelectQueryParameter; + + @added(ApiVersions.v2022_12_01_preview) + @query + @doc("Filter the result list using the given expression.") + filter?: string; + + @removed(ApiVersions.v2022_12_01_preview) + @query + expand?: string; +} + +interface ResourceOperations + extends Azure.Core.ResourceOperations {} + +@route("/versioning") +interface VersioningOp { + @pollingOperation(ResourceOperations.GetResourceOperationStatus) + export is ResourceOperations.LongRunningResourceAction; + + list is ResourceOperations.ResourceList>; + + @added(ApiVersions.v2022_12_01_preview) + @sharedRoute + create is ResourceOperations.ResourceCreateOrReplace; + + @added(ApiVersions.v2022_09_01) + @removed(ApiVersions.v2022_12_01_preview) + @sharedRoute + createLongRunning is ResourceOperations.LongRunningResourceCreateOrReplace; +} diff --git a/packages/typespec-java/emitter-tests/tsp/visibility.tsp b/packages/typespec-java/emitter-tests/tsp/visibility.tsp new file mode 100644 index 0000000000..db783adb25 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/visibility.tsp @@ -0,0 +1,72 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@service(#{ title: "Visibility" }) +@client({ + service: TspTest.Visibility, + name: "VisibilityClient", +}) +namespace TspTest.Visibility; + +model Dog { + @visibility(Lifecycle.Read) id: int32; + @visibility(Lifecycle.Create, Lifecycle.Update) secretName: string; + + // no flags are same as specifying all Lifecycle + name: string; +} + +model RoundTripModel { + name: string; + @visibility(Lifecycle.Create, Lifecycle.Update) secretName: string; +} + +// The spread operator will copy all the properties of Dog into ReadDog, +// and withVisibility will remove any that don't match the current +// visibility setting +@withVisibility(Lifecycle.Read) +model ReadDog { + ...Dog; +} + +@withVisibility(Lifecycle.Create, Lifecycle.Update) +model WriteDog { + ...Dog; +} + +@operationGroup +interface VisibilityRead { + @get + @route("/read") + get(): { + @body body: Dog; + }; +} + +@operationGroup +interface VisibilityWrite { + @put + @route("/write") + create(@body dog: WriteDog): { + @body body: Dog; + }; +} + +@operationGroup +@route("/visibility") +interface VisibilityOp extends VisibilityRead, VisibilityWrite { + @post + @route("/query") + query(@body dog: WriteDog): { + @body body: ReadDog; + }; + + @put + @route("/roundtrip") + roundtrip(@body body: RoundTripModel): { + @body body: RoundTripModel; + }; +} diff --git a/packages/typespec-java/emitter-tests/tsp/wire-type.tsp b/packages/typespec-java/emitter-tests/tsp/wire-type.tsp new file mode 100644 index 0000000000..3246351ffe --- /dev/null +++ b/packages/typespec-java/emitter-tests/tsp/wire-type.tsp @@ -0,0 +1,47 @@ +import "@typespec/rest"; +import "@azure-tools/typespec-client-generator-core"; + +using TypeSpec.Http; +using Azure.ClientGenerator.Core; + +@doc("Test for mismatch of wire type and client type on class constructors.") +@service(#{ title: "WireType" }) +namespace TspTest.WireType; + +model SuperClassMismatch { + @encode(DateTimeKnownEncoding.rfc7231, string) + dateTimeRfc7231: utcDateTime; +} + +model SuperClass { + dateTime: utcDateTime; +} + +model SubClass extends SuperClassMismatch { + dateTime: utcDateTime; +} + +model SubClassMismatch extends SuperClass { + @encode(DateTimeKnownEncoding.rfc7231, string) + dateTimeRfc7231: utcDateTime; +} + +model SubClassBothMismatch extends SuperClassMismatch { + @encode(BytesKnownEncoding.base64url, string) + base64url: bytes; +} + +@route("/wireType") +interface WireTypeOp { + @route("/superClassMismatch") + @put + superClassMismatch(@body body: SubClass): SubClass; + + @route("/subClassMismatch") + @put + subClassMismatch(@body body: SubClassMismatch): SubClassMismatch; + + @route("/bothClassMismatch") + @put + bothClassMismatch(@body body: SubClassBothMismatch): SubClassBothMismatch; +} diff --git a/packages/typespec-java/emitter-tests/tspconfig.yaml b/packages/typespec-java/emitter-tests/tspconfig.yaml new file mode 100644 index 0000000000..7a189350e8 --- /dev/null +++ b/packages/typespec-java/emitter-tests/tspconfig.yaml @@ -0,0 +1,14 @@ +emit: + - "@azure-tools/typespec-java" +options: + "@azure-tools/typespec-java": + emitter-output-dir: "{project-root}/tsp-output" + partial-update: true + generate-samples: true + generate-tests: true + examples-dir: "{project-root}/tsp/examples" + dev-options: + generate-code-model: true + loglevel: info + debug: false + profile: false diff --git a/packages/typespec-java/src/typespec-extension/package.json b/packages/typespec-java/package.json similarity index 65% rename from packages/typespec-java/src/typespec-extension/package.json rename to packages/typespec-java/package.json index 3245bed9a5..e58a300a9d 100644 --- a/packages/typespec-java/src/typespec-extension/package.json +++ b/packages/typespec-java/package.json @@ -1,13 +1,14 @@ { "name": "@azure-tools/typespec-java", - "version": "0.44.6", + "version": "0.45.4", "description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding", "keywords": [ "TypeSpec" ], "author": "Microsoft Corporation", - "homepage": "https://github.com/Azure/typespec-azure", - "readme": "https://github.com/Azure/typespec-azure/blob/main/typespec-extension/readme.md", + "homepage": "https://azure.github.io/typespec-azure", + "readme": "https://github.com/Azure/typespec-azure/blob/main/packages/typespec-java/README.md", + "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/Azure/typespec-azure.git" @@ -15,7 +16,6 @@ "bugs": { "url": "https://github.com/Azure/typespec-azure/issues" }, - "license": "MIT", "type": "module", "main": "dist/src/index.js", "exports": { @@ -28,54 +28,54 @@ "node": ">=22.0.0" }, "scripts": { - "clean": "rimraf ./dist ./temp", - "build": "node -e \"const{cpSync}=require('fs');cpSync('../../../../core/packages/http-client-java/emitter/src','./src',{recursive:true,filter:(s)=>!s.endsWith('options.ts')})\" && mvn install -f ../../../../core/packages/http-client-java/generator/pom.xml -Dspotless.skip=true -DskipTests=true && cp -r ../../../../core/packages/http-client-java/generator/http-client-generator/target/ ./target/ && tsc -p .", + "clean": "rimraf ./dist ./temp ./generator", + "build": "npm run build:generator && npm run build:emitter", + "build:emitter": "pwsh -NoProfile -File Copy-Sources.ps1 && tsc -p .", + "build:generator": "pwsh -NoProfile -File Build-Generator.ps1", "watch": "tsc -p . --watch", - "test:java:e2e": "vitest run", - "format": "npm run -s prettier -- --write", - "check-format": "npm run prettier -- --check", - "prettier": "prettier --config ./.prettierrc.yaml **/*.ts", - "regen-docs": "tspd doc . --enable-experimental --output-dir ./website/src/content/docs/docs/emitters/clients/typespec-java/reference --skip-js" + "test": "vitest run", + "regen-docs": "pnpm run build:emitter && tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/clients/typespec-java/reference --skip-js" }, "files": [ "lib/*.tsp", "dist/**", "!dist/test/**", - "target/emitter.jar", - "target/classes/PerfAutomation.jfc" + "generator/http-client-generator/target/emitter.jar", + "generator/http-client-generator/target/classes/PerfAutomation.jfc" ], "peerDependencies": { - "@azure-tools/codegen": "catalog:", - "@azure-tools/openai-typespec": "catalog:", "@azure-tools/typespec-autorest": "workspace:^", "@azure-tools/typespec-azure-core": "workspace:^", "@azure-tools/typespec-azure-resource-manager": "workspace:^", "@azure-tools/typespec-azure-rulesets": "workspace:^", "@azure-tools/typespec-client-generator-core": "workspace:^", "@azure-tools/typespec-liftr-base": "catalog:", + "@azure-tools/openai-typespec": "catalog:", "@typespec/compiler": "workspace:^", + "@typespec/events": "workspace:^", "@typespec/http": "workspace:^", "@typespec/openapi": "workspace:^", - "@typespec/openapi3": "workspace:^", "@typespec/rest": "workspace:^", + "@typespec/sse": "workspace:^", + "@typespec/streams": "workspace:^", "@typespec/versioning": "workspace:^", "@typespec/xml": "workspace:^" }, "dependencies": { "@autorest/codemodel": "catalog:", + "@azure-tools/codegen": "catalog:", "js-yaml": "catalog:", - "lodash": "catalog:" + "lodash": "catalog:", + "yaml": "catalog:" }, "devDependencies": { - "@azure-tools/codegen": "catalog:", - "@azure-tools/openai-typespec": "catalog:", "@azure-tools/typespec-autorest": "workspace:^", "@azure-tools/typespec-azure-core": "workspace:^", "@azure-tools/typespec-azure-resource-manager": "workspace:^", "@azure-tools/typespec-azure-rulesets": "workspace:^", "@azure-tools/typespec-client-generator-core": "workspace:^", "@azure-tools/typespec-liftr-base": "catalog:", - "@microsoft/api-extractor": "catalog:", + "@azure-tools/openai-typespec": "catalog:", "@types/js-yaml": "catalog:", "@types/lodash": "catalog:", "@types/node": "catalog:", @@ -83,16 +83,12 @@ "@typespec/events": "workspace:^", "@typespec/http": "workspace:^", "@typespec/openapi": "workspace:^", - "@typespec/openapi3": "workspace:^", "@typespec/rest": "workspace:^", "@typespec/sse": "workspace:^", "@typespec/streams": "workspace:^", "@typespec/tspd": "workspace:^", "@typespec/versioning": "workspace:^", "@typespec/xml": "workspace:^", - "@vitest/coverage-v8": "catalog:", - "@vitest/ui": "catalog:", - "c8": "catalog:", "rimraf": "catalog:", "typescript": "catalog:", "vitest": "catalog:" diff --git a/packages/typespec-java/src/AGENTS.md b/packages/typespec-java/src/AGENTS.md deleted file mode 100644 index b9887b1237..0000000000 --- a/packages/typespec-java/src/AGENTS.md +++ /dev/null @@ -1,61 +0,0 @@ -# Development - -The emitter is the [TypeSpec](https://typespec.io/) library for emitting Java client from the TypeSpec REST protocol binding. - -See [Emitter](https://typespec.io/docs/extending-typespec/emitters-basics/) for the basics on the TypeSpec emitter library. - -See [Developer Guide for TypeSpec Emitter](docs/developer/typespec/readme.md) for basics on this repository. - -Guideline: - -- Most of the development work should happen in "core/packages/http-client-java" folder. -- Before starting the development in "core" folder, always checkout latest code from main branch, and create a dev branch upon it. -- When checking in code in "core" folder, do not check-in the files in "core.patch". -- When preparing the PR, create 2 PRs, one for the code changes in submodule ("typespec" repository, if there is change), one for the code changes in this repository (which would include the update on "core" submodule). - -## TypeScript Part for the Emitter - -TypeScript code for the Emitter is in "core/packages/http-client-java/emitter" folder. Follow the package.json for the build and unit test. - -The code there, in runtime, produces a "code-model.yaml" file, and passes it to Java Part to generate Java client. - -## Java Part for the Emitter - -Java code for the Emitter is in "core/packages/http-client-java/generator/http-client-generator" (which depends on "http-client-generator-core" and "http-client-generator-mgmt" module). Follow the pom.xml for the build and unit test. - -The code there, in runtime, consumes the "code-model.yaml" file produced by the TypeSpec Part, and generate the Java client. - -# Update and Release - -## Update Node.js Package for Latest Dependencies - -Instructions: - -- Always use absolute path when change directory. - -Steps: - -1. In "core" folder, run `git pull upstream main` to fetch latest commit from upstream or origin. -2. Go back to project root. Commit the change in "core" folder. -3. Run `ncu -u` on "package.json" in both "package.json" from "typespec-extension" and "typespec-tests" folder. -4. Update package versions in `peerDependencies` (keep the semver range) in "package.json" from "typespec-extension" folder, according to the corresponding package versions in `devDependencies`. -5. Update version of "@azure-tools/openai-typespec" lib in "package.json" from "typespec-extension" folder, set it to the same semantic version used in https://raw.githubusercontent.com/Azure/azure-rest-api-specs/refs/heads/main/package.json -6. Update package versions in `override` (keep the semver range) in "package.json" from "typespec-tests" folder, according to the corresponding package versions in "package.json" from "typespec-extension" folder. -7. Save the files, and run `npm install` in "typespec-extension" folder, so that "package-lock.json" would be updated. -8. Run `npm audit fix` in "typespec-extension" folder. -9. Commit the changes in "typespec-extension" and "typespec-tests" folders. -10. Run `pwsh SyncTests.ps1` in "typespec-tests" folder. -11. Commit the changes in "typespec-tests" folder, include new files. - -## Prepare for Minor/Patch Release - -Steps: - -1. Bump minor/patch version of `@typespec/typespec-java` in both "package.json" from "typespec-extension" and "typespec-tests" folder. -2. Save the file, and run `npm install` in "typespec-extension" folder, so that "package-lock.json" would be updated. -3. Add a new item in release history in "typespec-extension/changelog.md". The version would be the minor/patch version. The date would be today. - -The [publish to NPM pipeline](https://dev.azure.com/azure-sdk/internal/_build?definitionId=5618) needs to be triggered, after the PR is merged. - -After release, the [sync SDK pipeline](https://dev.azure.com/azure-sdk/internal/_build?definitionId=6270) needs to be triggered, to sync the released typespec-java into the SDK repository. -This pipeline also regenerates all SDK based on TypeSpec. diff --git a/packages/typespec-java/src/azure-typespec-customization/CHANGELOG.md b/packages/typespec-java/src/azure-typespec-customization/CHANGELOG.md deleted file mode 100644 index 938854b8ad..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/CHANGELOG.md +++ /dev/null @@ -1,144 +0,0 @@ -# Release History - -## 1.0.0-beta.11 (2025-06-12) - -### Breaking Changes - -- Removed Eclipse-based customization framework, only JavaParser-based customization framework is available. -- Removed `ConstructorCustomization`, `ConstantCustomization`, `JavadocCustomization`, `MethodCustomization`, and - `PropertyCustomization` class. -- Removed all APIs in `ClassCustomization` except `customizeAst`. - -## 1.0.0-beta.10 (2025-05-28) - -### Features Added - -- Added JavaParser-based customization framework that only allows modifications using `ClassCustomization.customizeAst` - that doesn't support code refactoring concepts (all customizations must fully know what to change). -- Added ability to determine whether to use classic Eclipse-based or new JavaParser-based customization framework. - -### Breaking Changes - -- Turned all `*Customization` classes into interfaces to support separate Eclipse language server and JavaParser-based - customization frameworks. - -## 1.0.0-beta.9 (2024-11-21) - -### Other Changes - -- Replaced model types in Eclipse language server with a dependency of LSP4J. - -## 1.0.0-beta.8 (2023-11-03) - -### Other Changes - -- Removed usage of `google-java-format` and `jna-platform`. - -## 1.0.0-beta.7 (2023-04-26) - -### Other Changes - -- Upgraded dependency versions. - -## 1.0.0-beta.6 (2022-10-26) - -### Features Added - -- Support for stream-style customizations using `azure-json` and `azure-xml`. - -## 1.0.0-beta.5 (2022-05-24) - -### Features Added - -- Support for constructor customizations. - - Added get and add constructor to class customization. - - Add or remove annotations from constructor. - - Get constructor javadoc customization. - - Replace parameters or body of constructor. - - Set constructor modifier. -- Support for constant customizations. - - Added get constant to class customization. - - Add or remove annotations from constant. - - Get constant javadoc customization. - - Rename constant. - - Set constant modifier. -- Added remove method to class customization. -- Support for adding imports to a class when performing customizations. -- Added ability to customize the class abstract syntax tree to cover scenarios that haven't been developed yet. -- Support for adding a static initializer to a class. - -### Bugs Fixed - -- Fixes for javadoc parsing. -- Fixes for line indentation. - -### Other Changes - -- General performance improvements when performing customizations. - -## 1.0.0-beta.4 (2021-04-19) - -### Features Added - -- Added ability to change method parameters in method customization. -- Added listing all classes in package customization. - -### Breaking Changes - -- Added `Logger` parameter to `Customization` constructor. -- Customizations now return a new instance when chaining instead of returning the modified instance. - -### Bugs Fixed - -- Fixed a bug where parsing deprecated javadocs checked for sees javadocs. - -### Other Changes - -- General performance improvements when performing customizations. - -## 1.0.0-beta.3 (2021-04-06) - -### Features Added - -- Added ability to replace method body in method customization. -- Support for setting multiple modifiers to class and method customizations. -- Added getters for javadoc customization properties. -- Added ability to remove since and deprecated in javadoc customization. - -### Breaking Changes - -- Replaced usage of `Modifier` class with Java's `Modifier` int flag. - -### Other Changes - -- General performance improvements when performing customizations. - -## 1.0.0-beta.2 (2021-01-28) - -### Features Added - -- Added remove annotation to method customization. -- Added add and remove annotation to property customization. - -## 1.0.0-beta.1 (2020-12-18) - -Initial release of `azure-autorest-customization`. - -### Features Added - -- Support for customizing classes. - - Renaming and changing modifiers of the class. - - Adding and removing annotations on the class. - - Renaming enums. - - Adding and getting methods. - - Getting properties and javadocs of the class. -- Support for customizing methods. - - Renaming, changing modifiers, and changing return type of the method. - - Adding annotations on the method. - - Getting javadocs of the method. -- Support for customizing properties. - - Renaming the property. - - Generating a getter and setter for the property. -- Support for customizing javadocs. - - Setting description, params, return, throws, see, since and deprecated. - - Removing param, return, and throws. diff --git a/packages/typespec-java/src/azure-typespec-customization/README.md b/packages/typespec-java/src/azure-typespec-customization/README.md deleted file mode 100644 index f2787af1ff..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/README.md +++ /dev/null @@ -1,663 +0,0 @@ -# Overview - -The `azure-autorest-customization` package provides APIs for customizing Autorest code generation safely and -programmatically to support special cases not supported by Autorest code generation directly using Eclipse language -server to ensure valid Java code. - -## Before You Customize - -Before customizing generated code, consider whether your change should be made in TypeSpec (`client.tsp`) instead. TypeSpec customizations are cleaner and survive regeneration. See the [TypeSpec Client Customizations Reference](https://github.com/Azure/azure-sdk-for-java/blob/main/eng/common/knowledge/customizing-client-tsp.md) for available decorators like `@@clientName`, `@@access`, etc. - -Use Java code customizations only when TypeSpec cannot express the behavior you need. - -To set up customizations, create a Maven project with dependency: - -```xml - - com.azure.tools - azure-autorest-customization - 1.0.0-beta.11 - -``` - -Create a customization class extending from `com.azure.autorest.customization.Customization` and override the -`void customize(LibraryCustomization, Logger)` method. You will have access to a `LibraryCustomization` class where you -will be able to customize the generated Java code before it's written to the disk. Currently, the following -customizations are supported: - -- [Change class modifier](#change-class-modifier) -- [Change method modifier](#change-method-modifier) -- [Change method return type](#change-method-return-type) -- [Change class super type](#change-class-super-type) -- [Add an annotation to a class](#add-an-annotation-to-a-class) -- [Add an annotation to a method](#add-an-annotation-to-a-method) -- [Add a field default value](#add-a-field-default-value) -- [Remove an annotation from a class](#remove-an-annotation-from-a-class) -- [Refactor: Generate the getter and setter methods for a property](#refactor-generate-the-getter-and-setter-methods-for-a-property) -- [Refactor: Rename an enum member name](#refactor-rename-an-enum-member-name) -- [Javadoc: Set the description for a class / method](#javadoc-set-the-description-for-a-class--method) -- [Javadoc: Set / remove a parameter's javadoc on a method](#javadoc-set--remove-a-parameters-javadoc-on-a-method) -- [Javadoc: Set the return javadoc on a method](#javadoc-set-the-return-javadoc-on-a-method) -- [Javadoc: Set / remove an exception's javadoc on a method ](#javadoc-add--remove-an-exceptions-javadoc-on-a-method) - -## Navigate through the packages and classes - -There are three primary customization classes currently available, `LibraryCustomization`, `PackageCustomization`, -and `ClassCustomization`. From a given `LibraryCustomization`, you can navigate through the packages and classes intuitively. - -## Change class modifier - -A class `Foo` - -```java readme-sample-change-class-modifier-initial -public class Foo { -} -``` - -with customization - -```java readme-sample-change-class-modifier-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - // Calling setModifiers without passing anything is equivalent to package-private. - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(ClassOrInterfaceDeclaration::setModifiers)); -} -``` - -will generate - -```java readme-sample-change-class-modifier-result -class Foo { -} -``` - -## Change method modifier - -A method `getBar` in the `Foo` class - -```java readme-sample-change-method-modifier-initial -public class Foo { - private Bar bar; - - public Bar getBar() { - return this.bar; - } -} -``` - -with customization - -```java readme-sample-change-method-modifier-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("getBar") - .forEach(method -> method.setModifiers(Modifier.Keyword.PRIVATE)))); -} -``` - -will generate - -```java readme-sample-change-method-modifier-result -public class Foo { - private Bar bar; - - private Bar getBar() { - return this.bar; - } -} -``` - -## Change method return type - -You can change a method's return type, and pass a String formatter to transform the original return value statement. -If the original return type is `void`, simply pass the full return value String expression in place of the String -formatter; if the new return type is `void`, simply pass `null`. - -A method `getId` in the `Foo` class - -```java readme-sample-change-method-return-type-initial -public class Foo { - private Bar bar; - - public Bar getBar() { - return this.bar; - } -} -``` - -with customization - -```java readme-sample-change-method-return-type-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> { - ast.addImport(UUID.class); - ast.getClassByName("Foo").ifPresent(clazz -> clazz.getMethodsByName("getId").forEach(method -> { - // change return type to UUID - method.setType("UUID"); - method.setBody(StaticJavaParser.parseBlock("{ return UUID.fromString(this.id); }")); - })); - }); -} -``` - -will generate - -```java readme-sample-change-method-return-type-result -public class Foo { - private String id; - - public UUID getId() { - return UUID.fromString(this.id); - } -} -``` - -The `UUID` class will be automatically imported. - -## Change class super type - -A class `Foo` extends `Bar` - -```java readme-sample-change-class-base-type-initial -public class Bar { -} -public class Foo extends Bar { -} -``` - -with customization - -```java readme-sample-change-class-base-type-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo") - .customizeAst(ast -> ast.getClassByName("foo").ifPresent(clazz -> { - String newTypeFullName = "com.azure.myservice.models.Bar1"; - ast.addImport(newTypeFullName); - clazz.getExtendedTypes().clear(); - clazz.addExtendedType(new ClassOrInterfaceType(null, "Bar1")); - })); -} -``` - -will generate - -```java readme-sample-change-class-base-type-result -public class Foo extends Bar1 { -} -``` - -## Add an annotation to a class - -A class `Foo` - -```java readme-sample-add-class-annotation-initial -public class Foo { -} -``` - -with customization - -```java readme-sample-add-class-annotation-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.addMarkerAnnotation("Deprecated"))); -} -``` - -will generate - -```java readme-sample-add-class-annotation-result -@Deprecated -public class Foo { -} -``` - -The `JsonClassDescription` class will be automatically imported. - -## Add an annotation to a method - -A method `getBar` in the `Foo` class - -```java readme-sample-add-method-annotation-initial -public class Foo { - private Bar bar; - - public Bar getBar() { - return this.bar; - } -} -``` - -with customization - -```java readme-sample-add-method-annotation-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("getBar") - .forEach(method -> method.addMarkerAnnotation("Deprecated")))); -} -``` - -will generate - -```java readme-sample-add-method-annotation-result -public class Foo { - private Bar bar; - - @Deprecated - public Bar getBar() { - return this.bar; - } -} -``` - -The `Deprecated` class will be automatically imported. - -## Add a field default value - -A class `Foo` - -```java readme-sample-add-a-field-default-value-initial -public class Foo { - private String bar; -} -``` - -with customization - -```java readme-sample-add-a-field-default-value-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo") - .customizeAst(ast -> ast.getClassByName("Foo") - .flatMap(clazz -> clazz.getFieldByName("bar")) - .ifPresent(barField -> - barField.getVariables().forEach(var -> { - if (var.getNameAsString().equals("bar")) { - var.setInitializer("\"bar\""); - } - }))); -} -``` - -will generate - -```java readme-sample-add-a-field-default-value-result -public class Foo { - private String bar = "bar"; -} -``` - -## Remove an annotation from a class - -A class `Foo` - -```java readme-sample-remove-class-annotation-initial -@Deprecated -public class Foo { -} -``` - -with customization - -```java readme-sample-remove-class-annotation-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .flatMap(clazz -> clazz.getAnnotationByName("Deprecated")) - .ifPresent(Node::remove)); -} -``` - -will generate - -```java readme-sample-remove-class-annotation-result -public class Foo { -} -``` - -## Refactor: Generate the getter and setter methods for a property - -A property `active` in the `Foo` class - -```java readme-sample-generate-getter-and-setter-initial -public class Foo { - private boolean active; -} -``` - -with customization - -```java readme-sample-generate-getter-and-setter-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> { - clazz.addMethod("isActive", Modifier.Keyword.PUBLIC) - .setType("boolean") - .setBody(StaticJavaParser.parseBlock("{ return this.active; }")); - clazz.addMethod("setActive", Modifier.Keyword.PUBLIC) - .setType("Foo") - .addParameter("boolean", "active") - .setBody(StaticJavaParser.parseBlock("{ this.active = active; return this; }")); - })); -} -``` - -will generate - -```java readme-sample-generate-getter-and-setter-result -public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - public Foo setActive(boolean active) { - this.active = active; - return this; - } -} -``` - -## Refactor: Rename an enum member name - -An enum member `JPG` in an enum class `ImageFileType`: - -```java readme-sample-rename-enum-member-initial -public enum ImageFileType { - GIF("gif"), - JPG("jpg"), - TIFF("tiff"), - PNG("png"); - - private final String value; - - ImageFileType(String value) { - this.value = value; - } -} -``` - -with customization - -```java readme-sample-rename-enum-member-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getEnumByName("Foo") - .ifPresent(clazz -> clazz.getEntries().stream() - .filter(entry -> "JPG".equals(entry.getName().getIdentifier())) - .forEach(entry -> entry.setName("JPEG")))); -} -``` - -will generate - -```java readme-sample-rename-enum-member-result -public enum ImageFileType { - GIF("gif"), - JPEG("jpg"), - TIFF("tiff"), - PNG("png"); - - private final String value; - - ImageFileType(String value) { - this.value = value; - } -} -``` - -This customization is guaranteed to not break the build. - -## Javadoc: Set the description for a class / method - -A class `Foo` - -```java readme-sample-change-javadoc-description-initial -/** Class Foo. */ -public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - public Foo setActive(boolean active) { - this.active = active; - return this; - } -} -``` - -with customization - -```java readme-sample-change-javadoc-description-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> { - clazz.setJavadocComment("A Foo object stored in Azure."); - clazz.getMethodsByName("setActive") - .forEach(method -> method.setJavadocComment("Set the active value.")); - })); -} -``` - -will generate - -```java readme-sample-change-javadoc-description-result -/** - * A Foo object stored in Azure. - */ -public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } -} -``` - -## Javadoc: Set / remove a parameter's javadoc on a method - -A class `Foo` - -```java readme-sample-change-javadoc-param-initial -public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } -} -``` - -with customization - -```java readme-sample-change-javadoc-param-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("setActive").forEach(method -> method.getJavadoc() - .ifPresent(javadoc -> method.setJavadocComment(javadoc.addBlockTag("param", "active", - "if the foo object is in active state")))))); -} -``` - -will generate - -```java readme-sample-change-javadoc-param-result -public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - * - * @param active if the foo object is in active state - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } -} -``` - -## Javadoc: Set the return javadoc on a method - -A `Foo` class - -```java readme-sample-change-javadoc-return-initial -public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - * - * @param active if the foo object is in active state - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } -} -``` - -with customization - -```java readme-sample-change-javadoc-return-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("setActive").forEach(method -> method.getJavadoc() - .ifPresent(javadoc -> method.setJavadocComment(javadoc.addBlockTag("return", - "the current foo object")))))); -} -``` - -will generate - -```java readme-sample-change-javadoc-return-result -public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - * - * @param active if the foo object is in active state - * @return the current foo object - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } -} -``` - -## Javadoc: Add / remove an exception's javadoc on a method - -A `FooClient` class - -```java readme-sample-change-javadoc-throws-initial -public class FooClient { - /** - * Create a Foo object. - * - * @param foo the foo object to create in Azure - * @return the response for creating the foo object - */ - public CreateFooResponse createFoo(Foo foo) { - /* REST call to create foo */ - return null; - } -} -``` - -with customization - -```java readme-sample-change-javadoc-throws-customization -@Override -public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("setActive").forEach(method -> method.getJavadoc() - .ifPresent(javadoc -> method.setJavadocComment(javadoc.addBlockTag("throws", "RuntimeException", - "An unsuccessful response is received")))))); -} -``` - -will generate - -```java readme-sample-change-javadoc-throws-result -/** - * Create a Foo object. - * - * @param foo the foo object to create in Azure - * @return the response for creating the foo object - * @throws RuntimeException An unsuccessful response is received - */ -public CreateFooResponse createFoo(Foo foo) { - /* REST call to create foo */ - return null; -} -``` - -# Troubleshooting - -## AutoRest fails with "Unable to format output file" - -The cause is that the customized Java code has syntax error. - -Possible root cause: - -- Bug in customization code. -- Bug in the `customization-base` package. - -Steps to diagnose and fix: - -1. Add `skip-formatting` flag to skip Java code formatting, and hence not checking the syntax error. -2. Compile or inspect the generated code, find the error. -3. Determine the root cause. If it is caused by bug in customization code, fix it. If it is caused by bug in `customization-base` package, report it in GitHub issues. -4. Remove `skip-formatting` flag. - -# Developer note - -`azure-autorest-customization` passes all generated code files to an Eclipse language server process to enable richer, -IDE-like functionality. For this to work correctly all required dependencies must be passed to the language server using -a dummy `pom.xml`, which can be found in `src/main/resources`. If you make changes to code generation and begin seeing -code customizations failing it may be that the `pom.xml` is missing required dependencies and is causing the language -server to change processing from IDE-like to a regex, or find and replace, style. diff --git a/packages/typespec-java/src/azure-typespec-customization/pom.xml b/packages/typespec-java/src/azure-typespec-customization/pom.xml deleted file mode 100644 index 04881ba219..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - 4.0.0 - - - azure-typespec-parent - com.azure.tools - 1.0.0-beta.1 - ../pom.xml - - - com.azure.tools - azure-typespec-customization - 1.0.0-beta.1 - - Microsoft Azure AutoRest for Java Customization - This module contains the base classes needed for customizing a generated library. - https://github.com/Azure/autorest.java - - - false - - - false - - - - - com.azure - azure-json - 1.5.1 - - - com.azure - azure-xml - 1.2.1 - - - com.azure.tools - azure-typespec-extension - 1.0.0-beta.5 - - - com.github.javaparser - javaparser-core - 3.25.10 - - - org.apache.ant - ant - 1.10.14 - - - org.eclipse.lsp4j - org.eclipse.lsp4j - 0.21.1 - - - - org.junit.jupiter - junit-jupiter-api - 5.13.4 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.13.4 - test - - - org.junit.jupiter - junit-jupiter-params - 5.13.4 - test - - - diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/ClassCustomization.java b/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/ClassCustomization.java deleted file mode 100644 index c681f40d49..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/ClassCustomization.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -import com.github.javaparser.StaticJavaParser; -import com.github.javaparser.ast.CompilationUnit; - -import java.util.function.Consumer; - -/** - * The class level customization for an AutoRest generated class. - */ -public final class ClassCustomization extends CodeCustomization { - private final String className; - - ClassCustomization(Editor editor, String packageName, String className) { - super(editor, packageName, className); - this.className = className; - } - - /** - * Gets the name of the class this customization is using. - * - * @return The name of the class. - */ - public String getClassName() { - return className; - } - - /** - * Allows for a fully controlled modification of the abstract syntax tree that represents this class. - * - * @param astCustomization The abstract syntax tree customization callback. - * @return This ClassCustomization with the abstract syntax tree changes applied. - */ - public ClassCustomization customizeAst(Consumer astCustomization) { - CompilationUnit astToEdit = StaticJavaParser.parse(editor.getFileContent(fileName)); - astCustomization.accept(astToEdit); - editor.replaceFile(fileName, astToEdit.toString()); - - return this; - } -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/CodeCustomization.java b/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/CodeCustomization.java deleted file mode 100644 index 9a318aacae..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/CodeCustomization.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -/** - * Base interface for all code based customizations. - */ -public abstract class CodeCustomization { - final Editor editor; - final String fileName; - - CodeCustomization(Editor editor, String packageName, String className) { - this.editor = editor; - this.fileName = "src/main/java/" + packageName.replace('.', '/') + "/" + className + ".java"; - } - - /** - * The Editor managing the state of the CodeCustomization. - * - * @return The Editor. - */ - public Editor getEditor() { - return editor; - } - - /** - * The name of the file containing where the code for the CodeCustomization exists. - * - * @return The name of the file. - */ - public String getFileName() { - return fileName; - } -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/Customization.java b/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/Customization.java deleted file mode 100644 index 3c4339b5a5..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/Customization.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -import org.slf4j.Logger; - -import java.util.Map; - -/** - * The base class for customization. Extend this class to plug into AutoRest generation. - */ -public abstract class Customization { - /** - * Start the customization process. This is called by the post processor in AutoRest. - * - * @param files the map of files generated in the previous steps in AutoRest - * @param logger the logger - * @return the map of files after customization - */ - public final Map run(Map files, Logger logger) { - Editor editor = new Editor(files); - customize(new LibraryCustomization(editor), logger); - return editor.getContents(); - } - - /** - * Override this method to customize the client library. - * - * @param libraryCustomization the top level customization object - * @param logger the logger - */ - public abstract void customize(LibraryCustomization libraryCustomization, Logger logger); -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/Editor.java b/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/Editor.java deleted file mode 100644 index 0d726f2e9f..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/Editor.java +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Scanner; -import java.util.stream.Collectors; - -/** - * The raw editor containing the current files being customized. - */ -public final class Editor { - private final Map contents; - private final Map> lines; - - /** - * Creates an editor instance with the file contents and the root directory path. - * - * @param contents the map from file relative paths (starting with "src/main/java") and file contents - */ - public Editor(Map contents) { - this.contents = new HashMap<>(contents); - this.lines = new HashMap<>(); - for (Map.Entry entry : contents.entrySet()) { - lines.put(entry.getKey(), splitContentIntoLines(entry.getValue())); - } - } - - /** - * Checks if the package exists in the editor. - * - * @param packageName the package name - * @return Whether the package exists - */ - public boolean packageExists(String packageName) { - String toFind = "src/main/java/" + packageName.replace('.', '/') + "/"; - return contents.keySet().stream().anyMatch(fileName -> fileName.startsWith(toFind)); - } - - /** - * Checks if a class exists in the editor. - * - * @param packageName the package name of the class - * @param className the class name - * @return Whether the class exists - */ - public boolean classExists(String packageName, String className) { - String fileName = "src/main/java/" + packageName.replace('.', '/') + "/" + className + ".java"; - return contents.containsKey(fileName); - } - - /** - * Lists all classes in a package. - * - * @param packageName the package name - * @return the list of classes in the package - */ - public List classesInPackage(String packageName) { - String packagePath = "src/main/java/" + packageName.replace(".", "/") + "/"; - return contents.keySet() - .stream() - .filter(fileName -> fileName.startsWith(packagePath)) - .map(fileName -> fileName.substring(packagePath.length(), fileName.length() - 5)) - .filter(className -> !className.contains("/")) - .collect(Collectors.toList()); - } - - /** - * Gets the mapping from file relative paths (starting with "src/main/java") to file contents. - * - * @return the mapping - */ - public Map getContents() { - return contents; - } - - /** - * Adds a new file. - * - * @param name the relative path of the file, starting with "src/main/java" - * @param content the file content - */ - public void addFile(String name, String content) { - addOrReplaceFile(name, content, false); - } - - /** - * Replaces an existing file with new content. - * - * @param name The relative path of the file, starting with "src/main/java". - * @param content The content of the file. - */ - public void replaceFile(String name, String content) { - addOrReplaceFile(name, content, true); - } - - private void addOrReplaceFile(String name, String content, boolean isReplace) { - if (isReplace || !contents.containsKey(name)) { - contents.put(name, content); - lines.put(name, splitContentIntoLines(content)); - } - } - - /** - * Removes a file. - * - * @param name the relative file path, starting with "src/main/java" - */ - public void removeFile(String name) { - contents.remove(name); - lines.remove(name); - } - - /** - * Gets the content of a file. - * - * @param name the relative path of a file, starting with "src/main/java" - * @return the file content - */ - public String getFileContent(String name) { - return contents.get(name); - } - - /** - * Gets the file content split into lines. - * - * @param name the relative path of a file, starting with "src/main/java" - * @return the file content split into lines - */ - public List getFileLines(String name) { - return lines.get(name); - } - - /** - * Gets a line in a file. - * - * @param name the relative path of a file, starting with "src/main/java" - * @param line the line number - * @return the file content in this line - */ - public String getFileLine(String name, int line) { - return lines.get(name).get(line); - } - - private static List splitContentIntoLines(String content) { - List res = new ArrayList<>(); - Scanner scanner = new Scanner(content); - while (scanner.hasNextLine()) { - res.add(scanner.nextLine()); - } - if (content.endsWith("\n")) { - res.add(""); - } - return res; - } - -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/LibraryCustomization.java b/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/LibraryCustomization.java deleted file mode 100644 index 8bffbcb623..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/LibraryCustomization.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -/** - * The top level customization for an AutoRest generated client library. - */ -public final class LibraryCustomization { - private final Editor editor; - - LibraryCustomization(Editor editor) { - this.editor = editor; - } - - /** - * Gets the package level customization for a Java package in the client library. - * - * @param packageName the fully qualified name of the package - * @return the package level customization. - */ - public PackageCustomization getPackage(String packageName) { - if (!editor.packageExists(packageName)) { - throw new IllegalArgumentException(packageName + " does not exist"); - } - return new PackageCustomization(editor, packageName); - } - - /** - * Gets the class level customization for a Java class in the client library. - * - * @param packageName the fully qualified name of the package - * @param className the simple name of the class - * @return the class level customization - */ - public ClassCustomization getClass(String packageName, String className) { - return getPackage(packageName).getClass(className); - } - - /** - * Gets the raw editor containing the current files being edited and eventually emitted to the disk. - * - * @return the raw editor - */ - public Editor getRawEditor() { - return editor; - } -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/PackageCustomization.java b/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/PackageCustomization.java deleted file mode 100644 index 140cc2dd9f..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/PackageCustomization.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * The package level customization for an AutoRest generated client library. - */ -public final class PackageCustomization { - private final Editor editor; - private final String packageName; - - PackageCustomization(Editor editor, String packageName) { - this.editor = editor; - this.packageName = packageName; - } - - /** - * Gets the class level customization for a Java class in the package. - * - * @param className the simple name of the class - * @return the class level customization - */ - public ClassCustomization getClass(String className) { - if (!editor.classExists(packageName, className)) { - throw new IllegalArgumentException(className + " does not exist in package " + packageName); - } - - return new ClassCustomization(editor, packageName, className); - } - - /** - * This method lists all the classes in this package. - * - * @return A list of classes that are in this package. - */ - public List listClasses() { - return editor.classesInPackage(packageName) - .stream() - .map(className -> new ClassCustomization(editor, packageName, className)) - .collect(Collectors.toList()); - } -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/implementation/Utils.java b/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/implementation/Utils.java deleted file mode 100644 index 79120f8919..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/java/com/azure/typespec/customization/implementation/Utils.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization.implementation; - -import java.io.File; - -public class Utils { - - public static void deleteDirectory(File directoryToBeDeleted) { - File[] allContents = directoryToBeDeleted.listFiles(); - if (allContents != null) { - for (File file : allContents) { - deleteDirectory(file); - } - } - directoryToBeDeleted.delete(); - } - - public static boolean isNullOrEmpty(CharSequence charSequence) { - return charSequence == null || charSequence.length() == 0; - } - - public static boolean isNullOrEmpty(T[] array) { - return array == null || array.length == 0; - } - - public static boolean isNullOrEmpty(Iterable iterable) { - return (iterable == null || !iterable.iterator().hasNext()); - } - - public static boolean isWindows() { - String osName = System.getProperty("os.name"); - return osName != null && osName.startsWith("Windows"); - } - - private Utils() { - } -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/main/resources/pom.xml b/packages/typespec-java/src/azure-typespec-customization/src/main/resources/pom.xml deleted file mode 100644 index 59b9cf3a3f..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/main/resources/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - 4.0.0 - - com.azure - typespec-generated-client - 1.0.0-beta.1 - - Microsoft Azure client library - This package contains the generated client library. - https://github.com/Azure/azure-sdk-for-java - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - scm:git:https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - - com.azure - azure-json - 1.5.1 - - - com.azure - azure-xml - 1.2.1 - - - com.azure - azure-core - 1.57.1 - - - com.azure - azure-core-http-netty - 1.16.3 - - - - - com.azure - azure-core-test - 1.27.0-beta.14 - test - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.14.0 - - 11 - 11 - - - - - - diff --git a/packages/typespec-java/src/azure-typespec-customization/src/samples/java/com/azure/typespec/customization/ReadmeSamples.java b/packages/typespec-java/src/azure-typespec-customization/src/samples/java/com/azure/typespec/customization/ReadmeSamples.java deleted file mode 100644 index 61f9dfd76c..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/samples/java/com/azure/typespec/customization/ReadmeSamples.java +++ /dev/null @@ -1,581 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -import com.github.javaparser.StaticJavaParser; -import com.github.javaparser.ast.Modifier; -import com.github.javaparser.ast.Node; -import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; -import com.github.javaparser.ast.type.ClassOrInterfaceType; -import org.slf4j.Logger; - -import java.util.UUID; - -/** - * README samples for post-code generation. - */ -@SuppressWarnings({"unused", "InnerClassMayBeStatic"}) -public class ReadmeSamples { - static class ChangeClassModifier extends Customization { - static class Initial { - // BEGIN: readme-sample-change-class-modifier-initial - public class Foo { - } - // END: readme-sample-change-class-modifier-initial - } - - // BEGIN: readme-sample-change-class-modifier-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - // Calling setModifiers without passing anything is equivalent to package-private. - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(ClassOrInterfaceDeclaration::setModifiers)); - } - // END: readme-sample-change-class-modifier-customization - - static class Result { - // BEGIN: readme-sample-change-class-modifier-result - class Foo { - } - // END: readme-sample-change-class-modifier-result - } - } - - static class ChangeMethodModifier extends Customization { - static class Initial { - // BEGIN: readme-sample-change-method-modifier-initial - public class Foo { - private Bar bar; - - public Bar getBar() { - return this.bar; - } - } - // END: readme-sample-change-method-modifier-initial - } - - // BEGIN: readme-sample-change-method-modifier-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("getBar") - .forEach(method -> method.setModifiers(Modifier.Keyword.PRIVATE)))); - } - // END: readme-sample-change-method-modifier-customization - - static class Result { - // BEGIN: readme-sample-change-method-modifier-result - public class Foo { - private Bar bar; - - private Bar getBar() { - return this.bar; - } - } - // END: readme-sample-change-method-modifier-result - } - } - - static class ChangeMethodReturnType extends Customization { - static class Initial { - // BEGIN: readme-sample-change-method-return-type-initial - public class Foo { - private Bar bar; - - public Bar getBar() { - return this.bar; - } - } - // END: readme-sample-change-method-return-type-initial - } - - // BEGIN: readme-sample-change-method-return-type-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> { - ast.addImport(UUID.class); - ast.getClassByName("Foo").ifPresent(clazz -> clazz.getMethodsByName("getId").forEach(method -> { - // change return type to UUID - method.setType("UUID"); - method.setBody(StaticJavaParser.parseBlock("{ return UUID.fromString(this.id); }")); - })); - }); - } - // END: readme-sample-change-method-return-type-customization - - static class Result { - // BEGIN: readme-sample-change-method-return-type-result - public class Foo { - private String id; - - public UUID getId() { - return UUID.fromString(this.id); - } - } - // END: readme-sample-change-method-return-type-result - } - } - - static class ChangeClassBaseType extends Customization { - static class Initial { - // BEGIN: readme-sample-change-class-base-type-initial - public class Bar { - } - public class Foo extends Bar { - } - // END: readme-sample-change-class-base-type-initial - } - - // BEGIN: readme-sample-change-class-base-type-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo") - .customizeAst(ast -> ast.getClassByName("foo").ifPresent(clazz -> { - String newTypeFullName = "com.azure.myservice.models.Bar1"; - ast.addImport(newTypeFullName); - clazz.getExtendedTypes().clear(); - clazz.addExtendedType(new ClassOrInterfaceType(null, "Bar1")); - })); - } - // END: readme-sample-change-class-base-type-customization - - static class Result { - public class Bar1 { - } - // BEGIN: readme-sample-change-class-base-type-result - public class Foo extends Bar1 { - } - // END: readme-sample-change-class-base-type-result - } - } - - static class AddClassAnnotation extends Customization { - static class Initial { - // BEGIN: readme-sample-add-class-annotation-initial - public class Foo { - } - // END: readme-sample-add-class-annotation-initial - } - - // BEGIN: readme-sample-add-class-annotation-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.addMarkerAnnotation("Deprecated"))); - } - // END: readme-sample-add-class-annotation-customization - - static class Result { - // BEGIN: readme-sample-add-class-annotation-result - @Deprecated - public class Foo { - } - // END: readme-sample-add-class-annotation-result - } - } - - static class AddMethodAnnotation extends Customization { - static class Initial { - // BEGIN: readme-sample-add-method-annotation-initial - public class Foo { - private Bar bar; - - public Bar getBar() { - return this.bar; - } - } - // END: readme-sample-add-method-annotation-initial - } - - // BEGIN: readme-sample-add-method-annotation-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("getBar") - .forEach(method -> method.addMarkerAnnotation("Deprecated")))); - } - // END: readme-sample-add-method-annotation-customization - - static class Result { - // BEGIN: readme-sample-add-method-annotation-result - public class Foo { - private Bar bar; - - @Deprecated - public Bar getBar() { - return this.bar; - } - } - // END: readme-sample-add-method-annotation-result - } - } - - static class AddFieldDefaultValue extends Customization { - static class Initial { - // BEGIN: readme-sample-add-a-field-default-value-initial - public class Foo { - private String bar; - } - // END: readme-sample-add-a-field-default-value-initial - } - - // BEGIN: readme-sample-add-a-field-default-value-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo") - .customizeAst(ast -> ast.getClassByName("Foo") - .flatMap(clazz -> clazz.getFieldByName("bar")) - .ifPresent(barField -> - barField.getVariables().forEach(var -> { - if (var.getNameAsString().equals("bar")) { - var.setInitializer("\"bar\""); - } - }))); - } - // END: readme-sample-add-a-field-default-value-customization - - static class Result { - // BEGIN: readme-sample-add-a-field-default-value-result - public class Foo { - private String bar = "bar"; - } - // END: readme-sample-add-a-field-default-value-result - } - } - - static class RemoveClassAnnotation extends Customization { - static class Initial { - // BEGIN: readme-sample-remove-class-annotation-initial - @Deprecated - public class Foo { - } - // END: readme-sample-remove-class-annotation-initial - } - - // BEGIN: readme-sample-remove-class-annotation-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .flatMap(clazz -> clazz.getAnnotationByName("Deprecated")) - .ifPresent(Node::remove)); - } - // END: readme-sample-remove-class-annotation-customization - - static class Result { - // BEGIN: readme-sample-remove-class-annotation-result - public class Foo { - } - // END: readme-sample-remove-class-annotation-result - } - } - - static class GenerateGetterAndSetter extends Customization { - static class Initial { - // BEGIN: readme-sample-generate-getter-and-setter-initial - public class Foo { - private boolean active; - } - // END: readme-sample-generate-getter-and-setter-initial - } - - // BEGIN: readme-sample-generate-getter-and-setter-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> { - clazz.addMethod("isActive", Modifier.Keyword.PUBLIC) - .setType("boolean") - .setBody(StaticJavaParser.parseBlock("{ return this.active; }")); - clazz.addMethod("setActive", Modifier.Keyword.PUBLIC) - .setType("Foo") - .addParameter("boolean", "active") - .setBody(StaticJavaParser.parseBlock("{ this.active = active; return this; }")); - })); - } - // END: readme-sample-generate-getter-and-setter-customization - - static class Result { - // BEGIN: readme-sample-generate-getter-and-setter-result - public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - public Foo setActive(boolean active) { - this.active = active; - return this; - } - } - // END: readme-sample-generate-getter-and-setter-result - } - } - - static class RenameEnumMember extends Customization { - static class Initial { - // BEGIN: readme-sample-rename-enum-member-initial - public enum ImageFileType { - GIF("gif"), - JPG("jpg"), - TIFF("tiff"), - PNG("png"); - - private final String value; - - ImageFileType(String value) { - this.value = value; - } - } - // END: readme-sample-rename-enum-member-initial - } - - // BEGIN: readme-sample-rename-enum-member-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getEnumByName("Foo") - .ifPresent(clazz -> clazz.getEntries().stream() - .filter(entry -> "JPG".equals(entry.getName().getIdentifier())) - .forEach(entry -> entry.setName("JPEG")))); - } - // END: readme-sample-rename-enum-member-customization - - static class Result { - // BEGIN: readme-sample-rename-enum-member-result - public enum ImageFileType { - GIF("gif"), - JPEG("jpg"), - TIFF("tiff"), - PNG("png"); - - private final String value; - - ImageFileType(String value) { - this.value = value; - } - } - // END: readme-sample-rename-enum-member-result - } - } - - static class ChangeJavadocDescription extends Customization { - static class Initial { - // BEGIN: readme-sample-change-javadoc-description-initial - /** Class Foo. */ - public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - public Foo setActive(boolean active) { - this.active = active; - return this; - } - } - // END: readme-sample-change-javadoc-description-initial - } - - // BEGIN: readme-sample-change-javadoc-description-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> { - clazz.setJavadocComment("A Foo object stored in Azure."); - clazz.getMethodsByName("setActive") - .forEach(method -> method.setJavadocComment("Set the active value.")); - })); - } - // END: readme-sample-change-javadoc-description-customization - - static class Result { - // BEGIN: readme-sample-change-javadoc-description-result - /** - * A Foo object stored in Azure. - */ - public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } - } - // END: readme-sample-change-javadoc-description-result - } - } - - static class ChangeJavadocParam extends Customization { - static class Initial { - // BEGIN: readme-sample-change-javadoc-param-initial - public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } - } - // END: readme-sample-change-javadoc-param-initial - } - - // BEGIN: readme-sample-change-javadoc-param-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("setActive").forEach(method -> method.getJavadoc() - .ifPresent(javadoc -> method.setJavadocComment(javadoc.addBlockTag("param", "active", - "if the foo object is in active state")))))); - } - // END: readme-sample-change-javadoc-param-customization - - static class Result { - // BEGIN: readme-sample-change-javadoc-param-result - public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - * - * @param active if the foo object is in active state - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } - } - // END: readme-sample-change-javadoc-param-result - } - } - - static class ChangeJavadocReturn extends Customization { - static class Initial { - // BEGIN: readme-sample-change-javadoc-return-initial - public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - * - * @param active if the foo object is in active state - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } - } - // END: readme-sample-change-javadoc-return-initial - } - - // BEGIN: readme-sample-change-javadoc-return-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("setActive").forEach(method -> method.getJavadoc() - .ifPresent(javadoc -> method.setJavadocComment(javadoc.addBlockTag("return", - "the current foo object")))))); - } - // END: readme-sample-change-javadoc-return-customization - - static class Result { - // BEGIN: readme-sample-change-javadoc-return-result - public class Foo { - private boolean active; - - public boolean isActive() { - return this.active; - } - - /** - * Set the active value. - * - * @param active if the foo object is in active state - * @return the current foo object - */ - public Foo setActive(boolean active) { - this.active = active; - return this; - } - } - // END: readme-sample-change-javadoc-return-result - } - } - - static class ChangeJavadocThrows extends Customization { - static class Initial { - // BEGIN: readme-sample-change-javadoc-throws-initial - public class FooClient { - /** - * Create a Foo object. - * - * @param foo the foo object to create in Azure - * @return the response for creating the foo object - */ - public CreateFooResponse createFoo(Foo foo) { - /* REST call to create foo */ - return null; - } - } - // END: readme-sample-change-javadoc-throws-initial - } - - // BEGIN: readme-sample-change-javadoc-throws-customization - @Override - public void customize(LibraryCustomization customization, Logger logger) { - customization.getClass("com.azure.myservice.models", "Foo").customizeAst(ast -> ast.getClassByName("Foo") - .ifPresent(clazz -> clazz.getMethodsByName("setActive").forEach(method -> method.getJavadoc() - .ifPresent(javadoc -> method.setJavadocComment(javadoc.addBlockTag("throws", "RuntimeException", - "An unsuccessful response is received")))))); - } - // END: readme-sample-change-javadoc-throws-customization - - static class Result { - // BEGIN: readme-sample-change-javadoc-throws-result - /** - * Create a Foo object. - * - * @param foo the foo object to create in Azure - * @return the response for creating the foo object - * @throws RuntimeException An unsuccessful response is received - */ - public CreateFooResponse createFoo(Foo foo) { - /* REST call to create foo */ - return null; - } - // END: readme-sample-change-javadoc-throws-result - } - } - - private static final class Bar { - } - - private static final class Foo { - } - - private static final class CreateFooResponse { - } -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/test/java/com/azure/typespec/customization/AnnotationTests.java b/packages/typespec-java/src/azure-typespec-customization/src/test/java/com/azure/typespec/customization/AnnotationTests.java deleted file mode 100644 index 36520d210d..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/test/java/com/azure/typespec/customization/AnnotationTests.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.customization; - -import com.azure.typespec.customization.implementation.Utils; -import com.azure.typespec.extension.base.util.FileUtils; -import com.github.javaparser.ast.Node; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.nio.file.Path; -import java.util.Collections; -import java.util.UUID; -import java.util.regex.Pattern; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** - * Tests for mutating annotations. - */ -public class AnnotationTests { - private static final Logger LOGGER = LoggerFactory.getLogger(AnnotationTests.class); - private static final Pattern WHITESPACE = Pattern.compile("\\s*"); - - - Path workingDir; - - @BeforeEach - public void setup() throws IOException { - workingDir = FileUtils.createTempDirectory("removeComplexAnnotation" + UUID.randomUUID()); - } - - @AfterEach - public void teardown() { - Utils.deleteDirectory(workingDir.toFile()); - } - - @Test - public void addAnnotation() { - - } - - @Test - public void removeSimpleAnnotation() { - - } - - @Test - public void removeComplexAnnotation() throws URISyntaxException { - final String fileName = "src/main/java/AnnotationTests/RemoveComplexAnnotation.java"; - final String fileContent = String.join(System.lineSeparator(), - "public class RemoveComplexAnnotation {", - " @JsonTypeInfo(", - " use = JsonTypeInfo.Id.NAME,", - " include = JsonTypeInfo.As.PROPERTY,", - " property = \"@odata.type\",", - " defaultImpl = RemoveComplexAnnotation.class,", - " visible = true)", - " public void methodWithComplexAnnotation() {", - " }", - "}"); - - final String expectedFileContent = String.join(System.lineSeparator(), - "public class RemoveComplexAnnotation {", - " public void methodWithComplexAnnotation() {", - " }", - "}"); - - Customization customization = new Customization() { - @Override - public void customize(LibraryCustomization libraryCustomization, Logger logger) { - ClassCustomization classCustomization = libraryCustomization.getClass("AnnotationTests", "RemoveComplexAnnotation") - .customizeAst(ast -> ast.getClassByName("RemoveComplexAnnotation") - .ifPresent(clazz -> clazz.getMethodsByName("methodWithComplexAnnotation") - .forEach(method -> method.getAnnotationByName("JsonTypeInfo").ifPresent(Node::remove)))); - - assertEquals(standardizeFileForComparison(expectedFileContent), - standardizeFileForComparison(libraryCustomization.getRawEditor() - .getFileContent(classCustomization.getFileName()))); - } - }; - - customization.run(Collections.singletonMap(fileName, fileContent), LOGGER); - } - - private static String standardizeFileForComparison(String content) { - return WHITESPACE.matcher(content).replaceAll(""); - } -} diff --git a/packages/typespec-java/src/azure-typespec-customization/src/test/java/com/azure/typespec/customization/ClassCustomizationTests.java b/packages/typespec-java/src/azure-typespec-customization/src/test/java/com/azure/typespec/customization/ClassCustomizationTests.java deleted file mode 100644 index c2e2764287..0000000000 --- a/packages/typespec-java/src/azure-typespec-customization/src/test/java/com/azure/typespec/customization/ClassCustomizationTests.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.azure.typespec.customization; - -import com.github.javaparser.StaticJavaParser; -import com.github.javaparser.ast.body.InitializerDeclaration; -import org.junit.jupiter.api.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.net.URISyntaxException; -import java.util.Collections; -import java.util.regex.Pattern; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -public class ClassCustomizationTests { - private static final Pattern WHITESPACE = Pattern.compile("\\s*"); - private static final Logger LOGGER = LoggerFactory.getLogger(AnnotationTests.class); - - @Test - public void testStaticCodeBlock() throws URISyntaxException { - - final String fileName = "src/main/java/foo/Foo.java"; - final String fileContent = String.join(System.lineSeparator(), - "public class Foo {", - "}"); - - final String expectedFileContent = String.join(System.lineSeparator(), - "public class Foo {", - " static { String a = \"foo\"; }", - "}"); - - Customization customization = new Customization() { - @Override - public void customize(LibraryCustomization libraryCustomization, Logger logger) { - ClassCustomization classCustomization = libraryCustomization.getClass("foo", "Foo") - .customizeAst(ast -> ast.getClassByName("Foo").ifPresent(clazz -> clazz.addStaticInitializer() - .addStatement(StaticJavaParser.parseStatement("String a = \"foo\";")))); - - assertEquals(standardizeFileForComparison(expectedFileContent), - standardizeFileForComparison(libraryCustomization.getRawEditor() - .getFileContent(classCustomization.getFileName()))); - } - }; - - customization.run(Collections.singletonMap(fileName, fileContent), LOGGER); - } - - @Test - public void testStaticCodeBlockWithImports() throws URISyntaxException { - - final String fileName = "src/main/java/foo/Foo.java"; - final String fileContent = String.join(System.lineSeparator(), - "public class Foo {", - " private String foo; ", - " public Foo(String foo) { ", - " this.foo = foo;", - " }", - "}"); - - final String expectedFileContent = String.join(System.lineSeparator(), - "import com.azure.core.util.BinaryData;", - "public class Foo {", - " static { String a = \"foo\"; }", - " private String foo;", - " public Foo(String foo) {", - " this.foo = foo;", - " }", - "}"); - - Customization customization = new Customization() { - @Override - public void customize(LibraryCustomization libraryCustomization, Logger logger) { - ClassCustomization classCustomization = libraryCustomization.getClass("foo", "Foo") - .customizeAst(ast -> { - ast.addImport("com.azure.core.util.BinaryData"); - ast.getClassByName("Foo").ifPresent(clazz -> clazz.getMembers() - .add(0, new InitializerDeclaration(true, - StaticJavaParser.parseBlock("{ String a = \"foo\"; }")))); - }); - - assertEquals(standardizeFileForComparison(expectedFileContent), - standardizeFileForComparison(libraryCustomization.getRawEditor() - .getFileContent(classCustomization.getFileName()))); - } - }; - - customization.run(Collections.singletonMap(fileName, fileContent), LOGGER); - } - - private static String standardizeFileForComparison(String content) { - return WHITESPACE.matcher(content).replaceAll(""); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/pom.xml b/packages/typespec-java/src/azure-typespec-extension/pom.xml deleted file mode 100644 index b97c80acc0..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - 4.0.0 - - - com.azure.tools - azure-typespec-parent - 1.0.0-beta.1 - ../pom.xml - - com.azure.tools - azure-typespec-extension - 1.0.0-beta.1 - - Microsoft Azure AutoRest for Java Extension - This module contains the base classes an utilities needed for writing an AutoRest extension in Java. - https://github.com/Azure/autorest.java - - - true - - - - - com.azure - azure-json - 1.5.1 - - - org.yaml - snakeyaml - 2.0 - - - org.slf4j - slf4j-api - 1.7.36 - - - diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/Connection.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/Connection.java deleted file mode 100644 index 771845d29e..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/Connection.java +++ /dev/null @@ -1,478 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.jsonrpc; - -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.function.BiFunction; -import java.util.function.Function; -import java.util.function.Supplier; - -/** - * Represents a connection. - */ -public class Connection { - private OutputStream writer; - private PeekingBinaryReader reader; - private boolean isDisposed = false; - private final AtomicInteger requestId; - private final Map> tasks = new ConcurrentHashMap<>(); - private final ExecutorService executorService = Executors.newCachedThreadPool(); - private final CompletableFuture loop; - private final Map> dispatch = new ConcurrentHashMap<>(); - - /** - * Create a new Connection. - * - * @param writer The output stream to write to. - * @param input The input stream to read from. - */ - public Connection(OutputStream writer, InputStream input) { - this.writer = writer; - this.reader = new PeekingBinaryReader(input); - this.loop = CompletableFuture.runAsync(this::listen); - this.requestId = new AtomicInteger(0); - } - - private volatile boolean isAlive = true; - - /** - * Stops the connection. - */ - public void stop() { - isAlive = false; - loop.cancel(true); - } - - private String readJson() { - String jsonText = ""; - while (true) { - try { - jsonText += reader.readAsciiLine(); // + "\n"; - } catch (IOException e) { - throw new RuntimeException("Cannot read JSON input"); - } - try { - validateJsonText(jsonText); - return jsonText; - } catch (IOException e) { - // not enough text? - } - } - } - - /** - * Tests that the passed {@code jsonText} is valid JSON. - * - * @param jsonText The JSON text to validate. - * @throws IOException If the JSON text is invalid. - */ - private static void validateJsonText(String jsonText) throws IOException { - try (JsonReader jsonReader = JsonProviders.createReader(jsonText)) { - jsonReader.readUntyped(); - } - } - - /** - * Dispatches a message. - * - * @param path The path. - * @param method The method that gets the result as a JSON string. - */ - public void dispatch(String path, Supplier method) { - dispatch.put(path, input -> { - String result = method.get(); - - return (result == null) ? "null" : result; - }); - } - - private static List readArguments(String input) { - try (JsonReader jsonReader = JsonProviders.createReader(input)) { - List ret = jsonReader.readArray(JsonReader::getString); - if (ret.size() == 2) { - // Return passed array if size is larger than 0, otherwise return a new ArrayList - return ret; - } - - throw new RuntimeException("Invalid number of arguments"); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - } - - /** - * Dispatches a notification. - * - * @param path The path. - * @param method The method. - */ - public void dispatchNotification(String path, Runnable method) { - dispatch.put(path, input -> { - method.run(); - return null; - }); - } - - /** - * Dispatches a message. - * - * @param path The path. - * @param method The method that gets the result as a JSON string. - */ - public void dispatch(String path, BiFunction method) { - dispatch.put(path, input -> { - List args = readArguments(input); - return String.valueOf(method.apply(args.get(0), args.get(1))); - }); - } - - private String readJson(int contentLength) { - try { - return new String(reader.readBytes(contentLength), StandardCharsets.UTF_8); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - private boolean listen() { - while (isAlive) { - try { - int ch = reader.peekByte(); - if (-1 == ch) { - // didn't get anything. start again, it'll know if we're shutting down - break; - } - - if ('{' == ch || '[' == ch) { - // looks like a json block or array. let's do this. - // don't wait for this to finish! - process(readJson(), '{' == ch); - - // we're done here, start again. - continue; - } - - // We're looking at headers - Map headers = new HashMap<>(); - String line = reader.readAsciiLine(); - while (line != null && !line.isEmpty()) { - String[] bits = line.split(":", 2); - headers.put(bits[0].trim(), bits[1].trim()); - line = reader.readAsciiLine(); - } - - ch = reader.peekByte(); - // the next character had better be a { or [ - if ('{' == ch || '[' == ch) { - String contentLengthStr = headers.get("Content-Length"); - if (contentLengthStr != null && !contentLengthStr.isEmpty()) { - int contentLength = Integer.parseInt(contentLengthStr); - // don't wait for this to finish! - process(readJson(contentLength), '{' == ch); - continue; - } - // looks like a json block or array. let's do this. - // don't wait for this to finish! - process(readJson(), '{' == ch); - // we're done here, start again. - continue; - } - - return false; - - } catch (Exception e) { - if (!isAlive) { - throw new RuntimeException(e); - } - } - } - return false; - } - - /** - * Processes a message. - * - * @param content The content. - * @param isObject Whether the JSON {@code content} is a JSON object. - */ - public void process(String content, boolean isObject) { - // The only times this method is called is when the beginning portion of the JSON text is '{' or '['. - // So, instead of the previous design when using Jackson where a fully processed JsonNode was passed, use a - // simpler parameter 'isObject' to check if we are in a valid processing state. - if (!isObject) { - System.err.println("Unhandled: Batch Request"); - return; - } - - executorService.submit(() -> { - - try (JsonReader jsonReader = JsonProviders.createReader(content)) { - Map jobject = jsonReader.readMap(reader -> { - if (reader.isStartArrayOrObject()) { - return reader.readChildren(); - } else { - return reader.getString(); - } - }); - - String method = jobject.get("method"); - if (method != null) { - int id = processIdField(jobject.get("id")); - - // this is a method call. - // pass it to the service that is listening... - if (dispatch.containsKey(method)) { - Function fn = dispatch.get(method); - String parameters = jobject.get("params"); - String result = fn.apply(parameters); - if (id != -1) { - // if this is a request, send the response. - respond(id, result); - } - } - return; - } - - if (jobject.containsKey("result")) { - String result = jobject.get("result"); - int id = processIdField(jobject.get("id")); - if (id != -1) { - CompletableFuture f = tasks.remove(id); - - try { - f.complete(result); - } catch (Exception e) { - f.completeExceptionally(e); - } - } - return; - } - - String error = jobject.get("error"); - if (error != null) { - int id = processIdField(jobject.get("id")); - if (id != -1) { - CompletableFuture f = tasks.remove(id); - - try (JsonReader errorReader = JsonProviders.createReader(error)) { - Map errorObject = errorReader.readMap(JsonReader::readUntyped); - - String message = String.valueOf(errorObject.get("message")); - Object dataField = errorObject.get("data"); - if (dataField != null) { - message += " (" + dataField + ")"; - } - f.completeExceptionally(new RuntimeException(message)); - } catch (Exception e) { - f.completeExceptionally(e); - } - } - } - } catch (Exception e) { - e.printStackTrace(); - } - }); - } - - private static int processIdField(String idField) { - return (idField == null) ? -1 : Integer.parseInt(idField); - } - - /** - * Closes the connection. - * - * @throws IOException If an I/O error occurs. - */ - protected void close() throws IOException { - // ensure that we are in a cancelled state. - isAlive = false; - if (!isDisposed) { - // make sure we can't dispose twice - isDisposed = true; - tasks.forEach((ignored, future) -> future.cancel(true)); - - writer.close(); - writer = null; - reader.close(); - reader = null; - } - } - - private void send(String text) { - byte[] data = text.getBytes(StandardCharsets.UTF_8); - byte[] header = ("Content-Length: " + data.length + "\r\n\r\n").getBytes(StandardCharsets.US_ASCII); - byte[] buffer = new byte[header.length + data.length]; - System.arraycopy(header, 0, buffer, 0, header.length); - System.arraycopy(data, 0, buffer, header.length, data.length); - try { - writer.write(buffer); - writer.flush(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Sends an error. - * - * @param id The id. - * @param code The code. - * @param message The message. - */ - public void sendError(int id, int code, String message) { - try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - JsonWriter jsonWriter = JsonProviders.createWriter(outputStream)) { - jsonWriter.writeStartObject() - .writeStringField("jsonrpc", "2.0") - .writeIntField("id", id) - .writeStringField("message", message) - .writeStartObject("error") - .writeIntField("code", code) - .writeEndObject() - .writeEndObject() - .flush(); - - send(outputStream.toString(StandardCharsets.UTF_8)); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - } - - /** - * Sends a response. - * - * @param id The id. - * @param value The value. - */ - public void respond(int id, String value) { - try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - JsonWriter jsonWriter = JsonProviders.createWriter(outputStream)) { - jsonWriter.writeStartObject() - .writeStringField("jsonrpc", "2.0") - .writeIntField("id", id) - .writeRawField("result", value) - .writeEndObject() - .flush(); - - send(outputStream.toString(StandardCharsets.UTF_8)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Sends a notification. - * - * @param methodName The method name. - * @param values The values. - */ - public void notify(String methodName, Object... values) { - try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - JsonWriter jsonWriter = JsonProviders.createWriter(outputStream)) { - jsonWriter.writeArray(values, JsonWriter::writeUntyped).flush(); - notifyWithSerializedObject(methodName, outputStream.toString(StandardCharsets.UTF_8)); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - } - - /** - * Sends a notification. - * - * @param methodName The method name. - * @param serializedObject The serialized object. - */ - public void notifyWithSerializedObject(String methodName, String serializedObject) { - String json = (serializedObject == null) - ? "{\"jsonrpc\":\"2.0\",\"method\":\"" + methodName + "\"}" - : "{\"jsonrpc\":\"2.0\",\"method\":\"" + methodName + "\",\"params\":" + serializedObject + "}"; - - send(json); - } - - /** - * Sends a request. - * - * @param methodName The method name. - * @param values The values. - * @return The result. - */ - public String request(String methodName, Object... values) { - int id = requestId.getAndIncrement(); - CompletableFuture response = new CompletableFuture<>(); - tasks.put(id, response); - - try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - JsonWriter jsonWriter = JsonProviders.createWriter(outputStream)) { - jsonWriter.writeStartObject() - .writeStringField("jsonrpc", "2.0") - .writeStringField("method", methodName) - .writeIntField("id", id) - .writeArrayField("params", values, JsonWriter::writeUntyped) - .writeEndObject() - .flush(); - - send(outputStream.toString(StandardCharsets.UTF_8)); - - return response.get(); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } - } - - /** - * Sends a request. - * - * @param method The method name. - * @param serializedObject The serialized object. - * @return The result. - */ - public String requestWithSerializedObject(String method, String serializedObject) { - int id = requestId.getAndIncrement(); - CompletableFuture response = new CompletableFuture<>(); - tasks.put(id, response); - - String json = (serializedObject == null) - ? "{\"jsonrpc\":\"2.0\",\"method\":\"" + method + "\",\"id\":" + id + "}" - : "{\"jsonrpc\":\"2.0\",\"method\":\"" + method + "\",\"id\":" + id + ",\"params\":" + serializedObject + "}"; - - send(json); - try { - return response.get(); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } - } - - /** - * Waits for all requests to complete. - */ - public void waitForAll() { - try { - loop.get(); - } catch (InterruptedException | ExecutionException e) { - throw new RuntimeException(e); - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/PeekingBinaryReader.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/PeekingBinaryReader.java deleted file mode 100644 index 843934ba47..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/PeekingBinaryReader.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.jsonrpc; - -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStream; - -class PeekingBinaryReader implements Closeable { - Integer lastByte; - InputStream input; - - PeekingBinaryReader(InputStream input) { - this.lastByte = null; - this.input = input; - } - - int readByte() throws IOException { - if (lastByte != null) { - int result = lastByte; - lastByte = null; - return result; - } - return input.read(); - } - - int peekByte() throws IOException { - if (lastByte != null) { - return lastByte; - } - int result = readByte(); - if (result != -1) { - lastByte = result; - } - return result; - } - - byte[] readBytes(int count) throws IOException { - byte[] buffer = new byte[count]; - int read = 0; - if (count > 0 && lastByte != null) { - buffer[read++] = (byte) (int) lastByte; - lastByte = null; - } - while (read < count) { - read += input.read(buffer, read, count - read); - } - return buffer; - } - - String readAsciiLine() throws IOException { - StringBuilder result = new StringBuilder(); - int c = readByte(); - while (c != '\r' && c != '\n' && c != -1) { - result.append((char) c); - c = readByte(); - } - if (c == '\r' && peekByte() == '\n') { - readByte(); - } - if (c == -1 && result.length() == 0) { - return null; - } - return result.toString(); - } - - public void close() throws IOException { - input.close(); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/package-info.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/package-info.java deleted file mode 100644 index e2965178ca..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/jsonrpc/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * Contains JSON RPC related classes. - */ -package com.azure.typespec.extension.base.jsonrpc; diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/Message.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/Message.java deleted file mode 100644 index 451ba108c8..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/Message.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents a message. - */ -public class Message implements JsonSerializable { - - /** - * Represents a message channel. - */ - public MessageChannel channel; - - /** - * Represents details. - */ - public Object details; - - /** - * Represents text. - */ - public String text; - - /** - * Represents a key. - */ - public List key; - - /** - * Represents a source location. - */ - public List source; - - /** - * Creates a new instance of the Message class. - */ - public Message() { - } - - /** - * Gets the source location of the message. - * - * @return The source location of the message. - */ - public List getSource() { - return source; - } - - /** - * Gets the key of the message. - * - * @return The key of the message. - */ - public List getKey() { - return key; - } - - /** - * Gets the details of the message. - * - * @return The details of the message. - */ - public Object getDetails() { - return details; - } - - /** - * Gets the channel of the message. - * - * @return The channel of the message. - */ - public MessageChannel getChannel() { - return channel; - } - - /** - * Gets the text of the message. - * - * @return The text of the message. - */ - public String getText() { - return text; - } - - /** - * Sets the channel of the message. - * - * @param channel The channel of the message. - */ - public void setChannel(MessageChannel channel) { - this.channel = channel; - } - - /** - * Sets the details of the message. - * - * @param details The details of the message. - */ - public void setDetails(Object details) { - this.details = details; - } - - /** - * Sets the key of the message. - * - * @param key The key of the message. - */ - public void setKey(List key) { - this.key = key; - } - - /** - * Sets the source location of the message. - * - * @param source The source location of the message. - */ - public void setSource(List source) { - this.source = source; - } - - /** - * Sets the text of the message. - * - * @param text The text of the message. - */ - public void setText(String text) { - this.text = text; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("Channel", channel == null ? null : channel.toString()) - .writeUntypedField("Details", details) - .writeStringField("Text", text) - .writeArrayField("Key", key, JsonWriter::writeString) - .writeArrayField("Source", source, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Message instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Message instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Message fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Message message = new Message(); - - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("Channel".equals(fieldName)) { - message.channel = MessageChannel.valueOf(reader.getString()); - } else if ("Details".equals(fieldName)) { - message.details = reader.readUntyped(); - } else if ("Text".equals(fieldName)) { - message.text = reader.getString(); - } else if ("Key".equals(fieldName)) { - message.key = reader.readArray(JsonReader::getString); - } else if ("Source".equals(fieldName)) { - message.source = reader.readArray(SourceLocation::fromJson); - } else { - reader.skipChildren(); - } - } - - return message; - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/MessageChannel.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/MessageChannel.java deleted file mode 100644 index 40d436b53b..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/MessageChannel.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model; - -/** - * Represents a message channel. - */ -public enum MessageChannel { - /** - * Represents an information message. - */ - INFORMATION("information"), - - /** - * Represents a hint message. - */ - HINT("hint"), - - /** - * Represents a warning message. - */ - WARNING("warning"), - - /** - * Represents a debug message. - */ - DEBUG("debug"), - - /** - * Represents a verbose message. - */ - VERBOSE("verbose"), - - /** - * Represents an error message. - */ - ERROR("error"), - - /** - * Represents a fatal message. - */ - FATAL("fatal"), - - /** - * Represents a file message. - */ - FILE("file"), - - /** - * Represents a configuration message. - */ - CONFIGURATION("configuration"); - - private final String value; - - MessageChannel(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/SmartLocation.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/SmartLocation.java deleted file mode 100644 index 6a7f634b07..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/SmartLocation.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents a smart location. - */ -public class SmartLocation implements JsonSerializable { - private List path; - - /** - * Creates a new instance of the SmartLocation class. - */ - public SmartLocation() { - } - - /** - * Gets the path of the location. - * - * @return The path of the location. - */ - public List getPath() { - return path; - } - - /** - * Sets the path of the location. - * - * @param path The path of the location. - */ - public void setPath(List path) { - this.path = path; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("path", path, JsonWriter::writeUntyped) - .writeEndObject(); - } - - /** - * Deserializes a SmartLocation instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A SmartLocation instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static SmartLocation fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SmartLocation smartLocation = new SmartLocation(); - - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("path".equals(fieldName)) { - smartLocation.path = reader.readArray(JsonReader::readUntyped); - } else { - reader.skipChildren();; - } - } - - return smartLocation; - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/SourceLocation.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/SourceLocation.java deleted file mode 100644 index 9e231f477e..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/SourceLocation.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a source location. - */ -public class SourceLocation implements JsonSerializable { - private String document; - private SmartLocation position; - - /** - * Creates a new instance of the SourceLocation class. - */ - public SourceLocation() { - } - - /** - * Gets the position of the location. - * - * @return The position of the location. - */ - public SmartLocation getPosition() { - return position; - } - - /** - * Gets the document of the location. - * - * @return The document of the location. - */ - public String getDocument() { - return document; - } - - /** - * Sets the document of the location. - * - * @param document The document of the location. - */ - public void setDocument(String document) { - this.document = document; - } - - /** - * Sets the position of the location. - * - * @param position The position of the location. - */ - public void setPosition(SmartLocation position) { - this.position = position; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("document", document) - .writeJsonField("position", position) - .writeEndObject(); - } - - /** - * Deserializes a SourceLocation instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A SourceLocation instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static SourceLocation fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - SourceLocation sourceLocation = new SourceLocation(); - - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("document".equals(fieldName)) { - sourceLocation.document = reader.getString(); - } else if ("position".equals(fieldName)) { - sourceLocation.position = SmartLocation.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return sourceLocation; - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AndSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AndSchema.java deleted file mode 100644 index 763d589db1..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AndSchema.java +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.model.extensionmodel.XmsExtensions; -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Objects; - -/** - * An AND relationship between several schemas. - */ -public class AndSchema extends ComplexSchema { - private List allOf = new ArrayList<>(); - private String discriminatorValue; - - /** - * Creates a new instance of the AndSchema class. - */ - public AndSchema() { - super(); - } - - /** - * Gets the schemas that this schema composes. (Required) - * - * @return The schemas that this schema composes. - */ - public List getAllOf() { - return allOf; - } - - /** - * Sets the schemas that this schema composes. (Required) - * - * @param allOf The schemas that this schema composes. - */ - public void setAllOf(List allOf) { - this.allOf = allOf; - } - - /** - * Gets the value of the discriminator for this schema. - * - * @return The value of the discriminator for this schema. - */ - public String getDiscriminatorValue() { - return discriminatorValue; - } - - /** - * Sets the value of the discriminator for this schema. - * - * @param discriminatorValue The value of the discriminator for this schema. - */ - public void setDiscriminatorValue(String discriminatorValue) { - this.discriminatorValue = discriminatorValue; - } - - @Override - public String toString() { - return AndSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[allOf=" - + Objects.toString(allOf, "") + ",discriminatorValue=" - + Objects.toString(discriminatorValue, "") + ']'; - } - - @Override - public int hashCode() { - return Objects.hash(allOf, discriminatorValue); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof AndSchema)) { - return false; - } - AndSchema rhs = ((AndSchema) other); - return Objects.equals(allOf, rhs.allOf) && Objects.equals(discriminatorValue, rhs.discriminatorValue); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeArrayField("allOf", allOf, JsonWriter::writeJson) - .writeStringField("discriminatorValue", discriminatorValue) - .writeEndObject(); - } - - /** - * Deserializes an AndSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An AndSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static AndSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, AndSchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - - if ("allOf".equals(fieldName)) { - schema.allOf = reader.readArray(ComplexSchema::fromJson); - } else if ("discriminatorValue".equals(fieldName)) { - schema.discriminatorValue = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AnnotatedPropertyUtils.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AnnotatedPropertyUtils.java deleted file mode 100644 index 72ddb70ee7..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AnnotatedPropertyUtils.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import org.yaml.snakeyaml.introspector.BeanAccess; -import org.yaml.snakeyaml.introspector.Property; -import org.yaml.snakeyaml.introspector.PropertyUtils; - -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * PropertyUtils that leverage @YamlProperty annotation on getter methods. - * @see YamlProperty - */ -public class AnnotatedPropertyUtils extends PropertyUtils { - private final Map, Map> cachedPropertyMap = new HashMap<>(); - - /** - * Creates a new instance of AnnotatedPropertyUtils class. - */ - public AnnotatedPropertyUtils() { - super(); - } - - @Override - protected Map getPropertiesMap(Class type, BeanAccess bAccess) { - if (cachedPropertyMap.get(type) != null) { - return new LinkedHashMap<>(cachedPropertyMap.get(type)); - } - Map propertyMap = super.getPropertiesMap(type, bAccess); - Map mappedPropertyMap = new HashMap<>(); - for (String propertyName : propertyMap.keySet()) { - Property property = propertyMap.get(propertyName); - YamlProperty yamlProperty = property.getAnnotation(YamlProperty.class); - if (yamlProperty != null) { - mappedPropertyMap.put(yamlProperty.value(), property); - } - } - propertyMap.putAll(mappedPropertyMap); - cachedPropertyMap.put(type, propertyMap); - return propertyMap; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AnySchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AnySchema.java deleted file mode 100644 index 226e0ae18f..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/AnySchema.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * A schema that is non-object, non-complex. - */ -public class AnySchema extends Schema { - /** - * Creates a new instance of the AnySchema class. - */ - public AnySchema() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes an AnySchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An AnySchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static AnySchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, AnySchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ApiVersion.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ApiVersion.java deleted file mode 100644 index 3714ec3697..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ApiVersion.java +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * - since API version formats range from - * Azure ARM API date style (2018-01-01) to semver (1.2.3) - * and virtually any other text, this value tends to be an - * opaque string with the possibility of a modifier to indicate - * that it is a range. - *

- * options: - * - prepend a dash or append a plus to indicate a range - * (ie, '2018-01-01+' or '-2019-01-01', or '1.0+' ) - *

- * - semver-range style (ie, '^1.0.0' or '~1.0.0' ) - */ -public class ApiVersion implements JsonSerializable { - private String version; - private ApiVersion.Range range; - - /** - * Creates a new instance of the ApiVersion class. - */ - public ApiVersion() { - } - - /** - * Gets the API version string used in the API. (Required) - * - * @return The API version string used in the API. - */ - public String getVersion() { - return version; - } - - /** - * Sets the API version string used in the API. (Required) - * - * @param version The API version string used in the API. - */ - public void setVersion(String version) { - this.version = version; - } - - /** - * Gets the range of the API version. - * - * @return The range of the API version. - */ - public ApiVersion.Range getRange() { - return range; - } - - /** - * Sets the range of the API version. - * - * @param range The range of the API version. - */ - public void setRange(ApiVersion.Range range) { - this.range = range; - } - - @Override - public String toString() { - return ApiVersion.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[version=" - + Objects.toString(version, "") + ",range=" + Objects.toString(range, "") + ']'; - } - - @Override - public int hashCode() { - return Objects.hash(version, range); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof ApiVersion)) { - return false; - } - - ApiVersion rhs = ((ApiVersion) other); - return Objects.equals(version, rhs.version) && Objects.equals(range, rhs.range); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("version", version) - .writeStringField("range", range == null ? null : range.toString()) - .writeEndObject(); - } - - /** - * Deserializes an ApiVersion instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An ApiVersion instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ApiVersion fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ApiVersion::new, (version, fieldName, reader) -> { - if ("version".equals(fieldName)) { - version.version = reader.getString(); - } else if ("range".equals(fieldName)) { - version.range = ApiVersion.Range.fromValue(reader.getString()); - } else { - reader.skipChildren(); - } - }); - } - - /** - * Represents the range of the API version. - */ - public enum Range { - /** - * Represents a range that is empty. - */ - __EMPTY__("+"), - - /** - * Represents a range that is empty. - */ - __EMPTY___("-"); - private final String value; - - Range(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Gets the value of the range. - * - * @return The value of the range. - */ - public String value() { - return this.value; - } - - /** - * Parses a string value into a range value. - * - * @param value The string value to parse. - * @return The parsed range value. - * @throws IllegalArgumentException thrown if the value does not match any of the known range values. - */ - public static ApiVersion.Range fromValue(String value) { - if ("+".equals(value)) { - return __EMPTY__; - } else if ("-".equals(value)) { - return __EMPTY___; - } else { - throw new IllegalArgumentException(value); - } - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ArmIdSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ArmIdSchema.java deleted file mode 100644 index 557372f7d6..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ArmIdSchema.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents an ARM ID schema. - */ -public class ArmIdSchema extends PrimitiveSchema { - /** - * Creates a new instance of the ArmIdSchema class. - */ - public ArmIdSchema() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes an ArmIdSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An ArmIdSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ArmIdSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ArmIdSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ArraySchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ArraySchema.java deleted file mode 100644 index 60503821f9..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ArraySchema.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents an array schema. - */ -public class ArraySchema extends ValueSchema { - private Schema elementType; - private double maxItems; - private double minItems; - private boolean uniqueItems; - - /** - * Creates a new instance of the ArraySchema class. - */ - public ArraySchema() { - super(); - } - - /** - * Gets the type of elements in the array. (Required) - * - * @return The type of elements in the array. - */ - public Schema getElementType() { - return elementType; - } - - /** - * Sets the type of elements in the array. (Required) - * - * @param elementType The type of elements in the array. - */ - public void setElementType(Schema elementType) { - this.elementType = elementType; - } - - /** - * Gets the maximum number of elements in the array. - * - * @return The maximum number of elements in the array. - */ - public double getMaxItems() { - return maxItems; - } - - /** - * Sets the maximum number of elements in the array. - * - * @param maxItems The maximum number of elements in the array. - */ - public void setMaxItems(double maxItems) { - this.maxItems = maxItems; - } - - /** - * Gets the minimum number of elements in the array. - * - * @return The minimum number of elements in the array. - */ - public double getMinItems() { - return minItems; - } - - /** - * Sets the minimum number of elements in the array. - * - * @param minItems The minimum number of elements in the array. - */ - public void setMinItems(double minItems) { - this.minItems = minItems; - } - - /** - * Gets whether the elements in the array should be unique. - * - * @return Whether the elements in the array should be unique. - */ - public boolean isUniqueItems() { - return uniqueItems; - } - - /** - * Sets whether the elements in the array should be unique. - * - * @param uniqueItems Whether the elements in the array should be unique. - */ - public void setUniqueItems(boolean uniqueItems) { - this.uniqueItems = uniqueItems; - } - - @Override - public String toString() { - return ArraySchema.class.getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + "[elementType=" - + Objects.toString(elementType, "") + ",maxItems=" + maxItems + ",minItems=" + minItems - + ",uniqueItems=" + uniqueItems + ']'; - } - - @Override - public int hashCode() { - return Objects.hash(elementType, maxItems, minItems, uniqueItems); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof ArraySchema)) { - return false; - } - - ArraySchema rhs = ((ArraySchema) other); - return minItems == rhs.minItems && maxItems == rhs.maxItems && uniqueItems == rhs.uniqueItems - && Objects.equals(this.elementType, rhs.elementType); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeJsonField("elementType", elementType) - .writeDoubleField("maxItems", maxItems) - .writeDoubleField("minItems", minItems) - .writeBooleanField("uniqueItems", uniqueItems) - .writeEndObject(); - } - - /** - * Deserializes an ArraySchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An ArraySchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ArraySchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ArraySchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - - if ("elementType".equals(fieldName)) { - schema.elementType = Schema.fromJson(reader); - } else if ("maxItems".equals(fieldName)) { - schema.maxItems = reader.getDouble(); - } else if ("minItems".equals(fieldName)) { - schema.minItems = reader.getDouble(); - } else if ("uniqueItems".equals(fieldName)) { - schema.uniqueItems = reader.getBoolean(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/BinarySchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/BinarySchema.java deleted file mode 100644 index c826310126..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/BinarySchema.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represent a binary schema. - */ -public class BinarySchema extends Schema { - /** - * Create a new instance of the BinarySchema class. - */ - public BinarySchema() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a BinarySchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A BinarySchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static BinarySchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, BinarySchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/BooleanSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/BooleanSchema.java deleted file mode 100644 index af263d6241..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/BooleanSchema.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a boolean schema. - */ -public class BooleanSchema extends PrimitiveSchema { - - /** - * Creates a new instance of the BooleanSchema class. - */ - public BooleanSchema() { - super(); - } - - @Override - public String toString() { - return BooleanSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof BooleanSchema; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a BooleanSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A BooleanSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static BooleanSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, BooleanSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ByteArraySchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ByteArraySchema.java deleted file mode 100644 index 29f4cffb8e..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ByteArraySchema.java +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -/** - * Represents a byte array schema. - */ -public class ByteArraySchema extends PrimitiveSchema { - private ByteArraySchema.Format format; - - /** - * Creates a new instance of the ByteArraySchema class. - */ - public ByteArraySchema() { - super(); - } - - /** - * Gets the byte array format. (Required) - * - * @return The byte array format. - */ - public ByteArraySchema.Format getFormat() { - return format; - } - - /** - * Sets the byte array format. (Required) - * - * @param format The byte array format. - */ - public void setFormat(ByteArraySchema.Format format) { - this.format = format; - } - - @Override - public String toString() { - return ByteArraySchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[format=" - + Objects.toString(format, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hashCode(format); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof ByteArraySchema)) { - return false; - } - - ByteArraySchema rhs = ((ByteArraySchema) other); - return Objects.equals(format, rhs.format); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeStringField("format", format == null ? null : format.toString()) - .writeEndObject(); - } - - /** - * Deserializes a ByteArraySchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ByteArraySchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ByteArraySchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ByteArraySchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - - if ("format".equals(fieldName)) { - schema.format = ByteArraySchema.Format.fromValue(reader.getString()); - } else { - reader.skipChildren(); - } - }); - } - - /** - * Represents the format of the byte array. - */ - public enum Format { - /** - * The byte array is encoded as a base64url string. - */ - BASE_64_URL("base64url"), - - /** - * The byte array is encoded as a byte string. - */ - BYTE("byte"); - - private final String value; - - Format(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Gets the value of the format. - * - * @return The value of the format. - */ - public String value() { - return this.value; - } - - /** - * Parses a string to a ByteArraySchema.Format. - * - * @param value The value to parse. - * @return The parsed ByteArraySchema.Format. - * @throws IllegalArgumentException If the value does not match a known ByteArraySchema.Format. - */ - public static ByteArraySchema.Format fromValue(String value) { - if ("base64url".equals(value)) { - return BASE_64_URL; - } else if ("byte".equals(value)) { - return BYTE; - } else { - throw new IllegalArgumentException(value); - } - } - - } - -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CSharpLanguage.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CSharpLanguage.java deleted file mode 100644 index b3a2396e7c..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CSharpLanguage.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents the C# language. - */ -public class CSharpLanguage implements JsonSerializable { - - /** - * Creates a new instance of the CSharpLanguage class. - */ - public CSharpLanguage() { - } - - @Override - public String toString() { - return CSharpLanguage.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof CSharpLanguage; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject().writeEndObject(); - } - - /** - * Deserializes a CSharpLanguage instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A CSharpLanguage instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static CSharpLanguage fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readEmptyObject(jsonReader, CSharpLanguage::new); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CharSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CharSchema.java deleted file mode 100644 index cafe7e00cf..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CharSchema.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a char schema. - */ -public class CharSchema extends PrimitiveSchema { - - /** - * Creates a new instance of the CharSchema class. - */ - public CharSchema() { - super(); - } - - @Override - public String toString() { - return CharSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof CharSchema; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a CharSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A CharSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static CharSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, CharSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ChoiceSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ChoiceSchema.java deleted file mode 100644 index 37de06a0d0..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ChoiceSchema.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * Represents a choice schema. - */ -public class ChoiceSchema extends ValueSchema { - private Schema choiceType; - private List choices = new ArrayList<>(); - private String summary; - private String crossLanguageDefinitionId; - - /** - * Creates a new instance of the ChoiceSchema class. - */ - public ChoiceSchema() { - super(); - } - - /** - * Gets the type of the choice. (Required) - * - * @return The type of the choice. - */ - public Schema getChoiceType() { - return choiceType; - } - - /** - * Sets the type of the choice. (Required) - * - * @param choiceType The type of the choice. - */ - public void setChoiceType(Schema choiceType) { - this.choiceType = choiceType; - } - - /** - * Gets the possible choices. (Required) - * - * @return The possible choices. - */ - public List getChoices() { - return choices; - } - - /** - * Sets the possible choices. (Required) - * - * @param choices The possible choices. - */ - public void setChoices(List choices) { - this.choices = choices; - } - - @Override - public String getSummary() { - return summary; - } - - @Override - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * Gets the cross-language definition id. - * - * @return The cross-language definition id. - */ - public String getCrossLanguageDefinitionId() { - return crossLanguageDefinitionId; - } - - /** - * Sets the cross-language definition id. - * - * @param crossLanguageDefinitionId The cross-language definition id. - */ - public void setCrossLanguageDefinitionId(String crossLanguageDefinitionId) { - this.crossLanguageDefinitionId = crossLanguageDefinitionId; - } - - @Override - public String toString() { - return sharedToString(this, ChoiceSchema.class.getName()); - } - - static String sharedToString(ChoiceSchema value, String className) { - return className + "@" + Integer.toHexString(System.identityHashCode(value)) + "[choiceType=" - + Objects.toString(value.choiceType, "") + ",choices=" + Objects.toString(value.choices, "") - + ']'; - } - - @Override - public int hashCode() { - return sharedHashCode(this); - } - - static int sharedHashCode(ChoiceSchema value) { - return Objects.hash(value.choiceType, value.choices, value.getLanguage().getJava().getName()); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - if (!(other instanceof ChoiceSchema)) { - return false; - } - - return sharedEquals(this, (ChoiceSchema) other); - } - - static boolean sharedEquals(ChoiceSchema lhs, ChoiceSchema rhs) { - return Objects.equals(lhs.choiceType, rhs.choiceType) && Objects.equals(lhs.choices, rhs.choices) - && Objects.equals(lhs.getLanguage().getJava().getName(), rhs.getLanguage().getJava().getName()); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return writeParentProperties(jsonWriter.writeStartObject()).writeEndObject(); - } - - JsonWriter writeParentProperties(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter) - .writeJsonField("choiceType", choiceType) - .writeArrayField("choices", choices, JsonWriter::writeJson) - .writeStringField("summary", summary) - .writeStringField("crossLanguageDefinitionId", crossLanguageDefinitionId); - } - - /** - * Deserializes a ChoiceSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ChoiceSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ChoiceSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ChoiceSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } - - boolean tryConsumeParentProperties(ChoiceSchema schema, String fieldName, JsonReader reader) throws IOException { - if (super.tryConsumeParentProperties(schema, fieldName, reader)) { - return true; - } else if ("choiceType".equals(fieldName)) { - schema.choiceType = Schema.fromJson(reader); - return true; - } else if ("choices".equals(fieldName)) { - schema.choices = reader.readArray(ChoiceValue::fromJson); - return true; - } else if ("summary".equals(fieldName)) { - schema.summary = reader.getString(); - return true; - } else if ("crossLanguageDefinitionId".equals(fieldName)) { - schema.crossLanguageDefinitionId = reader.getString(); - return true; - } - - return false; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ChoiceValue.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ChoiceValue.java deleted file mode 100644 index 02812f3dab..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ChoiceValue.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a choice value. - */ -public class ChoiceValue implements JsonSerializable { - private Languages language; - private String value; - private DictionaryAny extensions; - - /** - * Creates a new instance of the ChoiceValue class. - */ - public ChoiceValue() { - } - - /** - * Gets the language for the choice value. (Required) - * - * @return The language for the choice value. - */ - public Languages getLanguage() { - return language; - } - - /** - * Sets the language for the choice value. (Required) - * - * @param language The language for the choice value. - */ - public void setLanguage(Languages language) { - this.language = language; - } - - /** - * Gets the value of the choice. (Required) - * - * @return The value of the choice. - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the choice. (Required) - * - * @param value The value of the choice. - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the extensions for the choice value. - * - * @return The extensions for the choice value. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the extensions for the choice value. - * - * @param extensions The extensions for the choice value. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return ChoiceValue.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[language=" - + Objects.toString(language, "") + ",value=" + Objects.toString(value, "") + ",extensions=" - + Objects.toString(extensions, "") + ']'; - } - - @Override - public int hashCode() { - return Objects.hash(value); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof ChoiceValue)) { - return false; - } - - ChoiceValue rhs = ((ChoiceValue) other); - return Objects.equals(this.value, rhs.value); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("language", language) - .writeStringField("value", value) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes a ChoiceValue instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ChoiceValue instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ChoiceValue fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ChoiceValue::new, (value, fieldName, reader) -> { - if ("language".equals(fieldName)) { - value.language = Languages.fromJson(reader); - } else if ("value".equals(fieldName)) { - value.value = reader.getString(); - } else if ("extensions".equals(fieldName)) { - value.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Client.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Client.java deleted file mode 100644 index 1c77b8b5cf..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Client.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a client. - */ -public class Client extends Metadata { - private String summary; - private List operationGroups = new ArrayList<>(); - private List globalParameters = new ArrayList<>(); - private Security security; - private List apiVersions = new ArrayList<>(); - private ServiceVersion serviceVersion; - private String crossLanguageDefinitionId; - - /** - * Creates a new instance of the Client class. - */ - public Client() { - super(); - } - - /** - * Gets the summary of the client. - * - * @return The summary of the client. - */ - public String getSummary() { - return summary; - } - - /** - * Sets the summary of the client. - * - * @param summary The summary of the client. - */ - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * Gets the operation groups of the client. - * - * @return The operation groups of the client. - */ - public List getOperationGroups() { - return operationGroups; - } - - /** - * Sets the operation groups of the client. - * - * @param operationGroups The operation groups of the client. - */ - public void setOperationGroups(List operationGroups) { - this.operationGroups = operationGroups; - } - - /** - * Gets the global parameters of the client. - * - * @return The global parameters of the client. - */ - public List getGlobalParameters() { - return globalParameters; - } - - /** - * Sets the global parameters of the client. - * - * @param globalParameters The global parameters of the client. - */ - public void setGlobalParameters(List globalParameters) { - this.globalParameters = globalParameters; - } - - /** - * Gets the security of the client. - * - * @return The security of the client. - */ - public Security getSecurity() { - return security; - } - - /** - * Sets the security of the client. - * - * @param security The security of the client. - */ - public void setSecurity(Security security) { - this.security = security; - } - - /** - * Gets the API versions of the client. - * - * @return The API versions of the client. - */ - public List getApiVersions() { - return apiVersions; - } - - /** - * Sets the API versions of the client. - * - * @param apiVersions The API versions of the client. - */ - public void setApiVersions(List apiVersions) { - this.apiVersions = apiVersions; - } - - /** - * Gets the service version of the client. - * - * @return The service version of the client. - */ - public ServiceVersion getServiceVersion() { - return serviceVersion; - } - - /** - * Sets the service version of the client. - * - * @param serviceVersion The service version of the client. - */ - public void setServiceVersion(ServiceVersion serviceVersion) { - this.serviceVersion = serviceVersion; - } - - /** - * Gets the cross-language definition id of the client. - * - * @return The cross-language definition id of the client. - */ - public String getCrossLanguageDefinitionId() { - return crossLanguageDefinitionId; - } - - /** - * Sets the cross-language definition id of the client. - * - * @param crossLanguageDefinitionId The cross-language definition id of the client. - */ - public void setCrossLanguageDefinitionId(String crossLanguageDefinitionId) { - this.crossLanguageDefinitionId = crossLanguageDefinitionId; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return writeParentProperties(jsonWriter.writeStartObject()).writeEndObject(); - } - - JsonWriter writeParentProperties(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter) - .writeStringField("summary", summary) - .writeArrayField("operationGroups", operationGroups, JsonWriter::writeJson) - .writeArrayField("globalParameters", globalParameters, JsonWriter::writeJson) - .writeJsonField("security", security) - .writeArrayField("apiVersions", apiVersions, JsonWriter::writeJson) - .writeJsonField("serviceVersion", serviceVersion) - .writeStringField("crossLanguageDefinitionId", crossLanguageDefinitionId); - } - - /** - * Deserializes a Client instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Client instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Client fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Client::new, (client, fieldName, reader) -> { - if (!client.tryConsumeParentProperties(client, fieldName, reader)) { - reader.skipChildren(); - } - }); - } - - boolean tryConsumeParentProperties(Client client, String fieldName, JsonReader reader) throws IOException { - if (super.tryConsumeParentProperties(client, fieldName, reader)) { - return true; - } else if ("summary".equals(fieldName)) { - client.summary = reader.getString(); - return true; - } else if ("operationGroups".equals(fieldName)) { - client.operationGroups = reader.readArray(OperationGroup::fromJson); - return true; - } else if ("globalParameters".equals(fieldName)) { - client.globalParameters = reader.readArray(Parameter::fromJson); - return true; - } else if ("security".equals(fieldName)) { - client.security = Security.fromJson(reader); - return true; - } else if ("apiVersions".equals(fieldName)) { - client.apiVersions = reader.readArray(ApiVersion::fromJson); - return true; - } else if ("serviceVersion".equals(fieldName)) { - client.serviceVersion = ServiceVersion.fromJson(reader); - return true; - } else if ("crossLanguageDefinitionId".equals(fieldName)) { - client.crossLanguageDefinitionId = reader.getString(); - return true; - } - - return false; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CodeModel.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CodeModel.java deleted file mode 100644 index 6cd7172806..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CodeModel.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a code model. - *

- * A code model contains all the information required to generate a service API. - */ -public class CodeModel extends Client { - private Info info; - private Schemas schemas; - private List clients = new ArrayList<>(); - private TestModel testModel; - - /** - * Creates a new instance of the CodeModel class. - */ - public CodeModel() { - super(); - } - - /** - * Gets the code model information. (Required) - * - * @return The code model information. - */ - public Info getInfo() { - return info; - } - - /** - * Sets the code model information. (Required) - * - * @param info The code model information. - */ - public void setInfo(Info info) { - this.info = info; - } - - /** - * Gets the full set of schemas for a given service, categorized into convenient collections. (Required) - * - * @return The full set of schemas for a given service, categorized into convenient collections. - */ - public Schemas getSchemas() { - return schemas; - } - - /** - * Sets the full set of schemas for a given service, categorized into convenient collections. (Required) - * - * @param schemas The full set of schemas for a given service, categorized into convenient collections. - */ - public void setSchemas(Schemas schemas) { - this.schemas = schemas; - } - - /** - * Gets the clients of the code model. - * - * @return The clients of the code model. - */ - public List getClients() { - return clients; - } - - /** - * Sets the clients of the code model. - * - * @param clients The clients of the code model. - */ - public void setClients(List clients) { - this.clients = clients; - } - - /** - * Gets the test model definition. - * - * @return The test model definition. - */ - public TestModel getTestModel() { - return testModel; - } - - /** - * Sets the test model definition. - * - * @param testModel The test model definition. - */ - public void setTestModel(TestModel testModel) { - this.testModel = testModel; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeJsonField("info", info) - .writeJsonField("schemas", schemas) - .writeArrayField("clients", clients, JsonWriter::writeJson) - .writeJsonField("testModel", testModel) - .writeEndObject(); - } - - /** - * Deserializes a CodeModel instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A CodeModel instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static CodeModel fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, CodeModel::new, (codeModel, fieldName, reader) -> { - if (codeModel.tryConsumeParentProperties(codeModel, fieldName, reader)) { - return; - } - - if ("info".equals(fieldName)) { - codeModel.info = Info.fromJson(reader); - } else if ("schemas".equals(fieldName)) { - codeModel.schemas = Schemas.fromJson(reader); - } else if ("clients".equals(fieldName)) { - codeModel.clients = reader.readArray(Client::fromJson); - } else if ("testModel".equals(fieldName)) { - codeModel.testModel = TestModel.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CodeModelCustomConstructor.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CodeModelCustomConstructor.java deleted file mode 100644 index a18c4ea06d..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CodeModelCustomConstructor.java +++ /dev/null @@ -1,412 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.model.extensionmodel.XmsExamples; -import org.yaml.snakeyaml.LoaderOptions; -import org.yaml.snakeyaml.constructor.Constructor; -import org.yaml.snakeyaml.nodes.MappingNode; -import org.yaml.snakeyaml.nodes.Node; -import org.yaml.snakeyaml.nodes.NodeId; -import org.yaml.snakeyaml.nodes.NodeTuple; -import org.yaml.snakeyaml.nodes.ScalarNode; -import org.yaml.snakeyaml.nodes.SequenceNode; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Custom constructor for a CodeModel. - */ -public class CodeModelCustomConstructor extends Constructor { - /** - * Creates a new instance of the CodeModelCustomConstructor class. - * - * @param loaderOptions The options for the loader. - */ - public CodeModelCustomConstructor(LoaderOptions loaderOptions) { - super(loaderOptions); - yamlClassConstructors.put(NodeId.scalar, new TypeEnumConstruct()); - yamlClassConstructors.put(NodeId.mapping, new TypeMapConstruct()); - } - - class TypeEnumConstruct extends Constructor.ConstructScalar { - @Override - public Object construct(Node node) { - Class type = node.getType(); - if (type.equals(Schema.AllSchemaTypes.class)) { - return Schema.AllSchemaTypes.fromValue(((ScalarNode) node).getValue()); - }/* else if (type.equals(ChoiceSchema.Type.class)) { - return ChoiceSchema.Type.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(SealedChoiceSchema.Type.class)) { - return SealedChoiceSchema.Type.fromValue(((ScalarNode) node).getValue()); - }*/ else if (type.equals(Parameter.ImplementationLocation.class)) { - return Parameter.ImplementationLocation.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(DateTimeSchema.Format.class)) { - return DateTimeSchema.Format.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(ByteArraySchema.Format.class)) { - return ByteArraySchema.Format.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(RequestParameterLocation.class)) { - return RequestParameterLocation.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(SerializationStyle.class)) { - return SerializationStyle.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(KnownMediaType.class)) { - return KnownMediaType.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(Scheme.SecuritySchemeType.class)) { - return Scheme.SecuritySchemeType.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(TestScenarioStepType.class)) { - return TestScenarioStepType.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(ScenarioTestScope.class)) { - return ScenarioTestScope.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(SchemaContext.class)) { - return SchemaContext.fromValue(((ScalarNode) node).getValue()); - } else if (type.equals(DurationSchema.Format.class)) { - return DurationSchema.Format.fromValue(((ScalarNode) node).getValue()); - } else { - // create JavaBean - return super.construct(node); - } - } - } - - class TypeMapConstruct extends Constructor.ConstructMapping { - @Override - public Object construct(Node node) { - MappingNode mappingNode = (MappingNode) node; - for (NodeTuple tuple : mappingNode.getValue()) { - ScalarNode key = (ScalarNode) tuple.getKeyNode(); - switch (key.getValue()) { - case "arrays": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(ArraySchema.class); - break; - } - case "ands": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(AndSchema.class); - break; - } - case "ors": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(OrSchema.class); - break; - } - case "xors": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(XorSchema.class); - break; - } - case "objects": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(ObjectSchema.class); - break; - } - case "choices": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(ChoiceSchema.class); - break; - } - case "parameterGroups": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(ParameterGroupSchema.class); - break; - } - case "sealedChoices": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(SealedChoiceSchema.class); - break; - } - case "flags": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(FlagSchema.class); - break; - } - case "dictionaries": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(DictionarySchema.class); - break; - } - case "constants": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(ConstantSchema.class); - break; - } - case "primitives": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(Object.class); - break; - } - case "properties": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(Property.class); - break; - } - case "binaries": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(BinarySchema.class); - break; - } - case "booleans": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(BooleanSchema.class); - break; - } - case "bytearrays": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(ByteArraySchema.class); - break; - } - case "numbers": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(NumberSchema.class); - break; - } - case "uris": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(UriSchema.class); - break; - } - case "anyObjects": - case "any": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(AnySchema.class); - break; - } - case "times": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(TimeSchema.class); - break; - } - case "armIds": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(ArmIdSchema.class); - break; - } - case "requests": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(Request.class); - break; - } - case "exceptions": - case "responses": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - value.setListType(Response.class); - break; - } - case "immediate": - case "all": - if (tuple.getValueNode() instanceof SequenceNode) { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - for (Node item : value.getValue()) { - item.setType(getSchemaTypeFromMappingNode((MappingNode) item)); - } - break; - } else if (tuple.getValueNode() instanceof MappingNode) { - MappingNode value = (MappingNode) tuple.getValueNode(); - for (NodeTuple item : value.getValue()) { - item.getValueNode() - .setType(getSchemaTypeFromMappingNode((MappingNode) (item.getValueNode()))); - } - break; - } - case "allOf": { - SequenceNode value = (SequenceNode) tuple.getValueNode(); - for (Node item : value.getValue()) { - item.setType(getSchemaTypeFromMappingNode((MappingNode) item)); - } - break; - } - case "choiceType": - case "elementType": - case "valueType": - case "schema": { - MappingNode value = (MappingNode) tuple.getValueNode(); - value.setType(getSchemaTypeFromMappingNode(value)); - break; - } - case "extensions": { - MappingNode value = (MappingNode) tuple.getValueNode(); - List actualValues = new ArrayList<>(); - for (NodeTuple extension : value.getValue()) { - ScalarNode keyNode = (ScalarNode) extension.getKeyNode(); - if ("x-ms-pageable".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsPageable", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-skip-url-encoding".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsSkipUrlEncoding", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-client-flatten".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsClientFlatten", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-long-running-operation".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsLongRunningOperation", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-flattened".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsFlattened", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-azure-resource".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsAzureResource", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-mutability".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsMutability", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-header-collection-prefix".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsHeaderCollectionPrefix", - keyNode.getStartMark(), keyNode.getEndMark(), keyNode.getScalarStyle()), - extension.getValueNode())); - } else if ("x-internal-autorest-anonymous-schema".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsInternalAutorestAnonymousSchema", - keyNode.getStartMark(), keyNode.getEndMark(), keyNode.getScalarStyle()), - extension.getValueNode())); - } else if ("x-ms-long-running-operation-options".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsLongRunningOperationOptions", - keyNode.getStartMark(), keyNode.getEndMark(), keyNode.getScalarStyle()), - extension.getValueNode())); - } else if ("x-ms-examples".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsExamples", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-arm-id-details".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsArmIdDetails", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-secret".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsSecret", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else if ("x-ms-versioning-added".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "xmsVersioningAdded", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } else { - // handle properties that do not contain hyphen in name - actualValues.add(new NodeTuple(keyNode, extension.getValueNode())); - } - } - value.setValue(actualValues); - break; - } - case "xmsLongRunningOperationOptions": { - MappingNode value = (MappingNode) tuple.getValueNode(); - List actualValues = new ArrayList<>(); - for (NodeTuple extension : value.getValue()) { - ScalarNode keyNode = (ScalarNode) extension.getKeyNode(); - if ("final-state-via".equals(keyNode.getValue())) { - actualValues.add(new NodeTuple( - new ScalarNode(keyNode.getTag(), "finalStateVia", keyNode.getStartMark(), - keyNode.getEndMark(), keyNode.getScalarStyle()), extension.getValueNode())); - } - } - value.setValue(actualValues); - break; - } - } - } - return super.construct(mappingNode); - } - - @Override - protected Object constructJavaBean2ndStep(MappingNode node, Object object) { - if (node.getType().equals(XmsExamples.class)) { - // deserialize to Map, while Object would be LinkedHashMap - Map examples = new HashMap<>(); - for (NodeTuple tuple : node.getValue()) { - examples.put(((ScalarNode) tuple.getKeyNode()).getValue(), constructObject(tuple.getValueNode())); - } - XmsExamples xmsExamples = new XmsExamples(); - xmsExamples.setExamples(examples); - return xmsExamples; - } else { - return super.constructJavaBean2ndStep(node, object); - } - } - } - - private static Class getSchemaTypeFromMappingNode(MappingNode value) { - for (NodeTuple schemaProps : value.getValue()) { - if (((ScalarNode) schemaProps.getKeyNode()).getValue().equals("type")) { - switch (((ScalarNode) schemaProps.getValueNode()).getValue()) { - case "any-object": - case "any": - return AnySchema.class; - case "and": - return AndSchema.class; - case "array": - return ArraySchema.class; - case "boolean": - return BooleanSchema.class; - case "binary": - return BinarySchema.class; - case "byte-array": - return ByteArraySchema.class; - case "char": - return CharSchema.class; - case "choice": - return ChoiceSchema.class; - case "constant": - return ConstantSchema.class; - case "credential": - return CredentialSchema.class; - case "date": - return DateSchema.class; - case "date-time": - return DateTimeSchema.class; - case "dictionary": - return DictionarySchema.class; - case "duration": - return DurationSchema.class; - case "flag": - return FlagSchema.class; - case "group": - return ObjectSchema.class; - case "integer": - return NumberSchema.class; - case "not": - return NotSchema.class; - case "number": - return NumberSchema.class; - case "object": - return ObjectSchema.class; - case "odata-query": - return ODataQuerySchema.class; - case "or": - return OrSchema.class; - case "parameter-group": - return ParameterGroupSchema.class; - case "sealed-choice": - return SealedChoiceSchema.class; - case "string": - return StringSchema.class; - case "time": - return TimeSchema.class; - case "unixtime": - return UnixTimeSchema.class; - case "uri": - return UriSchema.class; - case "uuid": - return UuidSchema.class; - case "xor": - return XorSchema.class; - case "arm-id": - return ArmIdSchema.class; - default: - return Schema.class; - } - } - } - return Schema.class; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ComplexSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ComplexSchema.java deleted file mode 100644 index f60fd3ce4f..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ComplexSchema.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a complex schema (types that can be an object). - */ -public class ComplexSchema extends Schema { - /** - * Creates a new instance of the ComplexSchema class. - */ - public ComplexSchema() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a ComplexSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ComplexSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ComplexSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ComplexSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConstantSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConstantSchema.java deleted file mode 100644 index f9e47ea936..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConstantSchema.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a constant schema. - */ -public class ConstantSchema extends Schema { - private Schema valueType; - private ConstantValue value; - - /** - * Creates a new instance of the ConstantSchema class. - */ - public ConstantSchema() { - super(); - } - - /** - * Gets the value type. (Required) - * - * @return The value type. - */ - public Schema getValueType() { - return valueType; - } - - /** - * Sets the value type. (Required) - * - * @param valueType The value type. - */ - public void setValueType(Schema valueType) { - this.valueType = valueType; - } - - /** - * Gets the actual constant value. (Required) - * - * @return The actual constant value. - */ - public ConstantValue getValue() { - return value; - } - - /** - * Sets the actual constant value. (Required) - * - * @param value The actual constant value. - */ - public void setValue(ConstantValue value) { - this.value = value; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("valueType", valueType) - .writeJsonField("value", value) - .writeEndObject(); - } - - /** - * Deserializes a ConstantSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ConstantSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ConstantSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ConstantSchema::new, (schema, fieldName, reader) -> { - if ("valueType".equals(fieldName)) { - schema.valueType = Schema.fromJson(reader); - } else if ("value".equals(fieldName)) { - schema.value = ConstantValue.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConstantValue.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConstantValue.java deleted file mode 100644 index 5919ee7ba4..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConstantValue.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a constant value. - */ -public class ConstantValue implements JsonSerializable { - private Languages language; - private Object value; - private DictionaryAny extensions; - - /** - * Creates a new instance of the ConstantValue class. - */ - public ConstantValue() { - } - - /** - * Gets the language of the value. (Required) - * - * @return The language of the value. - */ - public Languages getLanguage() { - return language; - } - - /** - * Sets the language of the value. (Required) - * - * @param language The language of the value. - */ - public void setLanguage(Languages language) { - this.language = language; - } - - /** - * Gets the actual constant value to use. (Required) - * - * @return The actual constant value to use. - */ - public Object getValue() { - return value; - } - - /** - * Sets the actual constant value to use. (Required) - * - * @param value The actual constant value to use. - */ - public void setValue(Object value) { - this.value = value; - } - - /** - * Gets the custom extensible metadata for individual language generators. - * - * @return The custom extensible metadata for individual language generators. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the custom extensible metadata for individual language generators. - * - * @param extensions The custom extensible metadata for individual language generators. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return ConstantValue.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[language=" - + language + ", value=" + value + ", extensions=" + extensions + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(language, extensions, value); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof ConstantValue)) { - return false; - } - - ConstantValue rhs = ((ConstantValue) other); - return Objects.equals(language, rhs.language) && Objects.equals(extensions, rhs.extensions) - && Objects.equals(value, rhs.value); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("language", language) - .writeUntypedField("value", value) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes a ConstantValue instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ConstantValue instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ConstantValue fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ConstantValue::new, (value, fieldName, reader) -> { - if ("language".equals(fieldName)) { - value.language = Languages.fromJson(reader); - } else if ("value".equals(fieldName)) { - value.value = reader.readUntyped(); - } else if ("extensions".equals(fieldName)) { - value.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Contact.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Contact.java deleted file mode 100644 index 9a2e173bdf..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Contact.java +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a contact. - */ -public class Contact implements JsonSerializable { - private String name; - private String url; - private String email; - private DictionaryAny extensions; - - /** - * Creates a new instance of the Contact class. - */ - public Contact() { - } - - /** - * Gets the name of the contact. - * - * @return The name of the contact. - */ - public String getName() { - return name; - } - - /** - * Sets the name of the contact. - * - * @param name The name of the contact. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets the URL of the contact. - * - * @return The URL of the contact. - */ - public String getUrl() { - return url; - } - - /** - * Sets the URL of the contact. - * - * @param url The URL of the contact. - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * Gets the email of the contact. - * - * @return The email of the contact. - */ - public String getEmail() { - return email; - } - - /** - * Sets the email of the contact. - * - * @param email The email of the contact. - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * Gets the custom extensible metadata for individual language generators. - * - * @return The custom extensible metadata for individual language generators. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the custom extensible metadata for individual language generators. - * - * @param extensions The custom extensible metadata for individual language generators. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return Contact.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[name=" + name - + ", url=" + url + ", email=" + email + ", extensions=" + extensions + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(name, extensions, url, email); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof Contact)) { - return false; - } - - Contact rhs = ((Contact) other); - return Objects.equals(name, rhs.name) && Objects.equals(extensions, rhs.extensions) - && Objects.equals(url, rhs.url) && Objects.equals(email, rhs.email); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("name", name) - .writeStringField("url", url) - .writeStringField("email", email) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes a Constant instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Constant instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Contact fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Contact::new, (contact, fieldName, reader) -> { - if ("name".equals(fieldName)) { - contact.name = reader.getString(); - } else if ("url".equals(fieldName)) { - contact.url = reader.getString(); - } else if ("email".equals(fieldName)) { - contact.email = reader.getString(); - } else if ("extensions".equals(fieldName)) { - contact.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConvenienceApi.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConvenienceApi.java deleted file mode 100644 index c97d98d9d6..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ConvenienceApi.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents a convenience API. - */ -public class ConvenienceApi extends Metadata { - private List requests; - - /** - * Creates a new instance of the ConvenienceApi class. - */ - public ConvenienceApi() { - super(); - } - - /** - * Gets the requests of the convenience API. - * - * @return The requests of the convenience API. - */ - public List getRequests() { - return requests; - } - - /** - * Sets the requests of the convenience API. - * - * @param requests The requests of the convenience API. - */ - public void setRequests(List requests) { - this.requests = requests; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeArrayField("requests", requests, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a ConvenienceApi instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ConvenienceApi instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ConvenienceApi fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ConvenienceApi::new, (convenienceApi, fieldName, reader) -> { - if (convenienceApi.tryConsumeParentProperties(convenienceApi, fieldName, reader)) { - return; - } - - if ("requests".equals(fieldName)) { - convenienceApi.requests = reader.readArray(Request::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CredentialSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CredentialSchema.java deleted file mode 100644 index e4bd1d90c3..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/CredentialSchema.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a credential schema. - */ -public class CredentialSchema extends PrimitiveSchema { - private double maxLength; - private double minLength; - private String pattern; - - /** - * Creates a new instance of the CredentialSchema class. - */ - public CredentialSchema() { - super(); - } - - /** - * Get the maximum length of the string. - * - * @return The maximum length of the string. - */ - public double getMaxLength() { - return maxLength; - } - - /** - * Set the maximum length of the string. - * - * @param maxLength The maximum length of the string. - */ - public void setMaxLength(double maxLength) { - this.maxLength = maxLength; - } - - /** - * Get the minimum length of the string. - * - * @return The minimum length of the string. - */ - public double getMinLength() { - return minLength; - } - - /** - * Set the minimum length of the string. - * - * @param minLength The minimum length of the string. - */ - public void setMinLength(double minLength) { - this.minLength = minLength; - } - - /** - * Get a regular expression that the string must be validated against. - * - * @return A regular expression that the string must be validated against. - */ - public String getPattern() { - return pattern; - } - - /** - * Set a regular expression that the string must be validated against. - * - * @param pattern A regular expression that the string must be validated against. - */ - public void setPattern(String pattern) { - this.pattern = pattern; - } - - @Override - public String toString() { - return CredentialSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) - + "[maxLength=" + maxLength + ",minLength=" + minLength + ",pattern=" + Objects.toString(pattern, "") - + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(pattern, maxLength, minLength); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof CredentialSchema)) { - return false; - } - - CredentialSchema rhs = ((CredentialSchema) other); - return Objects.equals(maxLength, rhs.maxLength) && Objects.equals(minLength, rhs.minLength) - && Objects.equals(pattern, rhs.pattern); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeDoubleField("maxLength", maxLength) - .writeDoubleField("minLength", minLength) - .writeStringField("pattern", pattern) - .writeEndObject(); - } - - /** - * Deserializes a CredentialSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A CredentialSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static CredentialSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, CredentialSchema::new, (schema, fieldName, reader) -> { - if ("maxLength".equals(fieldName)) { - schema.maxLength = reader.getDouble(); - } else if ("minLength".equals(fieldName)) { - schema.minLength = reader.getDouble(); - } else if ("pattern".equals(fieldName)) { - schema.pattern = reader.getString(); - } else { - reader.skipChildren();; - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DateSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DateSchema.java deleted file mode 100644 index 244fda5189..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DateSchema.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a date value. - */ -public class DateSchema extends PrimitiveSchema { - - /** - * Creates a new instance of the DateSchema class. - */ - public DateSchema() { - super(); - } - - @Override - public String toString() { - return DateSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof DateSchema; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a DateSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A DateSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static DateSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, DateSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DateTimeSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DateTimeSchema.java deleted file mode 100644 index 9ed85ff56b..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DateTimeSchema.java +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a date-time value. - */ -public class DateTimeSchema extends PrimitiveSchema { - private DateTimeSchema.Format format; - - /** - * Creates a new instance of the DateTimeSchema class. - */ - public DateTimeSchema() { - super(); - } - - /** - * Gets the date-time format. (Required) - * - * @return The date-time format. - */ - public DateTimeSchema.Format getFormat() { - return format; - } - - /** - * Sets the date-time format. (Required) - * - * @param format The date-time format. - */ - public void setFormat(DateTimeSchema.Format format) { - this.format = format; - } - - @Override - public String toString() { - return DateTimeSchema.class.getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + "[format=" - + Objects.toString(format, "") + ']'; - } - - @Override - public int hashCode() { - return Objects.hash(format); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof DateTimeSchema)) { - return false; - } - - DateTimeSchema rhs = ((DateTimeSchema) other); - return format == rhs.format; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("format", format == null ? null : format.toString()) - .writeEndObject(); - } - - /** - * Deserializes a DateTimeSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A DateTimeSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static DateTimeSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, DateTimeSchema::new, (schema, fieldName, reader) -> { - if ("format".equals(fieldName)) { - schema.format = Format.fromValue(reader.getString()); - } else { - reader.skipChildren(); - } - }); - } - - /** - * The format of the date-time. - */ - public enum Format { - /** - * The date-time format. - */ - DATE_TIME("date-time"), - - /** - * The RFC 1123 date-time format. - */ - DATE_TIME_RFC_1123("date-time-rfc1123"); - private final String value; - - Format(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Gets the value of the format. - * - * @return The value of the format. - */ - public String value() { - return this.value; - } - - /** - * Parses a value to a Format instance. - * - * @param value The value to parse. - * @return The parsed Format instance. - * @throws IllegalArgumentException If the value does not match a known Format. - */ - public static DateTimeSchema.Format fromValue(String value) { - if ("date-time".equals(value)) { - return DATE_TIME; - } else if ("date-time-rfc1123".equals(value)) { - return DATE_TIME_RFC_1123; - } else { - throw new IllegalArgumentException(value); - } - } - - } - -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Deprecation.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Deprecation.java deleted file mode 100644 index 3446df3ead..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Deprecation.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * Represents deprecation information. - */ -public class Deprecation implements JsonSerializable { - private String message; - private List apiVersions = new ArrayList<>(); - - /** - * Creates a new instance of the Deprecation class. - */ - public Deprecation() { - } - - /** - * Gets the deprecated message. (Required) - * - * @return The deprecated message. - */ - public String getMessage() { - return message; - } - - /** - * Sets the deprecated message. (Required) - * - * @param message The deprecated message. - */ - public void setMessage(String message) { - this.message = message; - } - - /** - * Gets the API versions that this deprecation is applicable to. (Required) - * - * @return The API versions that this deprecation is applicable to. - */ - public List getApiVersions() { - return apiVersions; - } - - /** - * Sets the API versions that this deprecation is applicable to. (Required) - * - * @param apiVersions The API versions that this deprecation is applicable to. - */ - public void setApiVersions(List apiVersions) { - this.apiVersions = apiVersions; - } - - @Override - public String toString() { - return Deprecation.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[message=" - + Objects.toString(message, "") + ",apiVersions=" + Objects.toString(apiVersions, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(message, apiVersions); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof Deprecation)) { - return false; - } - - Deprecation rhs = ((Deprecation) other); - return Objects.equals(message, rhs.message) && Objects.equals(apiVersions, rhs.apiVersions); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("message", message) - .writeArrayField("apiVersions", apiVersions, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Deprecation instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Deprecation instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Deprecation fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Deprecation::new, (deprecation, fieldName, reader) -> { - if ("message".equals(fieldName)) { - deprecation.message = reader.getString(); - } else if ("apiVersions".equals(fieldName)) { - deprecation.apiVersions = reader.readArray(ApiVersion::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionaryAny.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionaryAny.java deleted file mode 100644 index 92aa39289e..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionaryAny.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a dictionary of any type. - */ -public class DictionaryAny implements JsonSerializable { - - /** - * Creates a new instance of the DictionaryAny class. - */ - public DictionaryAny() { - } - - @Override - public String toString() { - return DictionaryAny.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof DictionaryAny; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject().writeEndObject(); - } - - /** - * Deserializes a DictionaryAny instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A DictionaryAny instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static DictionaryAny fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readEmptyObject(jsonReader, DictionaryAny::new); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionaryApiVersion.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionaryApiVersion.java deleted file mode 100644 index bfa51cae67..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionaryApiVersion.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.model.extensionmodel.XmsEnum; -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents the version of the dictionary API. - */ -public class DictionaryApiVersion implements JsonSerializable { - - /** - * Creates a new instance of the DictionaryApiVersion class. - */ - public DictionaryApiVersion() { - } - - @Override - public String toString() { - return DictionaryApiVersion.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof DictionaryApiVersion; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject().writeEndObject(); - } - - /** - * Deserializes a DictionaryApiVersion instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A DictionaryApiVersion instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static DictionaryApiVersion fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readEmptyObject(jsonReader, DictionaryApiVersion::new); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionarySchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionarySchema.java deleted file mode 100644 index 9cef502fff..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DictionarySchema.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a key-value collection. - */ -public class DictionarySchema extends ComplexSchema { - private Schema elementType; - private Boolean nullableItems; - - /** - * Creates a new instance of the DictionarySchema class. - */ - public DictionarySchema() { - super(); - } - - /** - * Gets the type of the elements in the dictionary. (Required) - * - * @return The type of the elements in the dictionary. - */ - public Schema getElementType() { - return elementType; - } - - /** - * Sets the type of the elements in the dictionary. (Required) - * - * @param elementType The type of the elements in the dictionary. - */ - public void setElementType(Schema elementType) { - this.elementType = elementType; - } - - /** - * Gets whether the items in the dictionary can be null. - * - * @return Whether the items in the dictionary can be null. - */ - public Boolean getNullableItems() { - return nullableItems; - } - - /** - * Sets whether the items in the dictionary can be null. - * - * @param nullableItems Whether the items in the dictionary can be null. - */ - public void setNullableItems(Boolean nullableItems) { - this.nullableItems = nullableItems; - } - - @Override - public String toString() { - return DictionarySchema.class.getName() + '@' + Integer.toHexString(System.identityHashCode(this)) - + "[elementType=" + Objects.toString(elementType, "") + ",nullableItems=" - + Objects.toString(nullableItems, "") + "]"; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - - if (!(o instanceof DictionarySchema)) { - return false; - } - - DictionarySchema that = (DictionarySchema) o; - return Objects.equals(elementType, that.elementType) && Objects.equals(nullableItems, that.nullableItems); - } - - @Override - public int hashCode() { - return Objects.hash(elementType, nullableItems); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("elementType", elementType) - .writeBooleanField("nullableItems", nullableItems) - .writeEndObject(); - } - - /** - * Deserializes a DictionarySchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A DictionarySchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static DictionarySchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, DictionarySchema::new, (schema, fieldName, reader) -> { - if ("elementType".equals(fieldName)) { - schema.elementType = Schema.fromJson(reader); - } else if ("nullableItems".equals(fieldName)) { - schema.nullableItems = reader.getNullable(JsonReader::getBoolean); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Discriminator.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Discriminator.java deleted file mode 100644 index f485236408..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Discriminator.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Map; - -/** - * Represents a discriminator for polymorphic types. - */ -public class Discriminator implements JsonSerializable { - private Property property; - private Map immediate; - private Map all; - - /** - * Creates a new instance of the Discriminator class. - */ - public Discriminator() { - } - - /** - * Gets the property that is used to discriminate between the polymorphic types. - * - * @return The property that is used to discriminate between the polymorphic types. - */ - public Property getProperty() { - return property; - } - - /** - * Sets the property that is used to discriminate between the polymorphic types. - * - * @param property The property that is used to discriminate between the polymorphic types. - */ - public void setProperty(Property property) { - this.property = property; - } - - /** - * Gets the immediate polymorphic types. - * - * @return The immediate polymorphic types. - */ - public Map getImmediate() { - return immediate; - } - - /** - * Sets the immediate polymorphic types. - * - * @param immediate The immediate polymorphic types. - */ - public void setImmediate(Map immediate) { - this.immediate = immediate; - } - - /** - * Gets all polymorphic types. - * - * @return All polymorphic types. - */ - public Map getAll() { - return all; - } - - /** - * Sets all polymorphic types. - * - * @param all All polymorphic types. - */ - public void setAll(Map all) { - this.all = all; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("property", property) - .writeMapField("immediate", immediate, JsonWriter::writeJson) - .writeMapField("all", all, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Discriminator instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Discriminator instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Discriminator fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Discriminator::new, (discriminator, fieldName, reader) -> { - if ("property".equals(fieldName)) { - discriminator.property = Property.fromJson(reader); - } else if ("immediate".equals(fieldName)) { - discriminator.immediate = reader.readMap(ComplexSchema::fromJson); - } else if ("all".equals(fieldName)) { - discriminator.all = reader.readMap(ComplexSchema::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DurationSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DurationSchema.java deleted file mode 100644 index 2ccd847ff1..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/DurationSchema.java +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a Duration value. - */ -public class DurationSchema extends PrimitiveSchema { - private Format format; - - /** - * Creates a new instance of the DurationSchema class. - */ - public DurationSchema() { - super(); - } - - /** - * Gets the duration format. - * - * @return The duration format. - */ - public Format getFormat() { - return format; - } - - /** - * Sets the duration format. - * - * @param format The duration format. - */ - public void setFormat(Format format) { - this.format = format; - } - - @Override - public String toString() { - return DurationSchema.class.getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + "[format=" - + Objects.toString(format, "") + ']'; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - - if (!(o instanceof DurationSchema)) { - return false; - } - - DurationSchema that = (DurationSchema) o; - return format == that.format; - } - - @Override - public int hashCode() { - return Objects.hash(format); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("format", format == null ? null : format.toString()) - .writeEndObject(); - } - - /** - * Deserializes a DurationSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A DurationSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static DurationSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, DurationSchema::new, (schema, fieldName, reader) -> { - if ("format".equals(fieldName)) { - schema.format = Format.fromValue(reader.getString()); - } else { - reader.skipChildren(); - } - }); - } - - /** - * The format of the duration. - */ - public enum Format { - /** - * The duration is in RFC3339 format. - */ - DURATION("duration-rfc3339"), - - /** - * The duration is in seconds as an integer. - */ - SECONDS_INTEGER("seconds-integer"), - - /** - * The duration is in seconds as a number. - */ - SECONDS_NUMBER("seconds-number"); - - private final String value; - - Format(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Gets the string value of the format. - * - * @return The string value of the format. - */ - public String value() { - return this.value; - } - - /** - * Parses a string value to a Format instance. - * - * @param value The string value to parse. - * @return The parsed Format instance. - * @throws IllegalArgumentException If the string value does not correspond to a valid Format instance. - */ - public static Format fromValue(String value) { - if ("duration-rfc3339".equals(value)) { - return DURATION; - } else if ("seconds-integer".equals(value)) { - return SECONDS_INTEGER; - } else if ("seconds-number".equals(value)) { - return SECONDS_NUMBER; - } else { - throw new IllegalArgumentException(value); - } - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ExternalDocumentation.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ExternalDocumentation.java deleted file mode 100644 index d737c2a4e6..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ExternalDocumentation.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a reference to external documentation. - */ -public class ExternalDocumentation implements JsonSerializable { - private String description; - private String url; - private DictionaryAny extensions; - - /** - * Creates a new instance of the ExternalDocumentation class. - */ - public ExternalDocumentation() { - } - - /** - * Gets the description of the external documentation. - * - * @return The description of the external documentation. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the external documentation. - * - * @param description The description of the external documentation. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the URL of the external documentation. - * - * @return The URL of the external documentation. - */ - public String getUrl() { - return url; - } - - /** - * Sets the URL of the external documentation. - * - * @param url The URL of the external documentation. - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * Gets the extensions of the external documentation. - * - * @return The extensions of the external documentation. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the extensions of the external documentation. - * - * @param extensions The extensions of the external documentation. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return ExternalDocumentation.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) - + "[description=" + Objects.toString(description, "") + ",url=" + Objects.toString(url, "") - + ",extensions=" + Objects.toString(extensions, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(description, extensions, url); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof ExternalDocumentation)) { - return false; - } - - ExternalDocumentation rhs = ((ExternalDocumentation) other); - return Objects.equals(description, rhs.description) && Objects.equals(url, rhs.url) - && Objects.equals(extensions, rhs.extensions); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("description", description) - .writeStringField("url", url) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes an ExternalDocumentation instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An ExternalDocumentation instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ExternalDocumentation fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ExternalDocumentation::new, (documentation, fieldName, reader) -> { - if ("description".equals(fieldName)) { - documentation.description = reader.getString(); - } else if ("url".equals(fieldName)) { - documentation.url = reader.getString(); - } else if ("extensions".equals(fieldName)) { - documentation.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/FlagSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/FlagSchema.java deleted file mode 100644 index 6709a08f70..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/FlagSchema.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * Represents a flag schema. - */ -public class FlagSchema extends ValueSchema { - private List choices = new ArrayList<>(); - - /** - * Creates a new instance of the FlagSchema class. - */ - public FlagSchema() { - super(); - } - - /** - * Get the possible choices in the set. (Required) - * - * @return The possible choices in the set. - */ - public List getChoices() { - return choices; - } - - /** - * Set the possible choices in the set. (Required) - * - * @param choices The possible choices in the set. - */ - public void setChoices(List choices) { - this.choices = choices; - } - - @Override - public String toString() { - return FlagSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[choices=" - + choices + "]"; - } - - @Override - public int hashCode() { - return Objects.hashCode(choices); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof FlagSchema)) { - return false; - } - - FlagSchema rhs = ((FlagSchema) other); - return Objects.equals(choices, rhs.choices); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("choices", choices, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a FlagSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A FlagSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static FlagSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, FlagSchema::new, (schema, fieldName, reader) -> { - if ("choices".equals(fieldName)) { - schema.choices = reader.readArray(FlagValue::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/FlagValue.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/FlagValue.java deleted file mode 100644 index db2524a171..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/FlagValue.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a flag value. - */ -public class FlagValue implements JsonSerializable { - private Languages language; - private double value; - private DictionaryAny extensions; - - /** - * Creates a new instance of the FlagValue class. - */ - public FlagValue() { - } - - /** - * Gets the language of the flag value. (Required) - * - * @return The language of the flag value. - */ - public Languages getLanguage() { - return language; - } - - /** - * Sets the language of the flag value. (Required) - * - * @param language The language of the flag value. - */ - public void setLanguage(Languages language) { - this.language = language; - } - - /** - * Gets the value of the flag. (Required) - * - * @return The value of the flag. - */ - public double getValue() { - return value; - } - - /** - * Sets the value of the flag. (Required) - * - * @param value The value of the flag. - */ - public void setValue(double value) { - this.value = value; - } - - /** - * Gets the extensions of the flag value. - * - * @return The extensions of the flag value. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the extensions of the flag value. - * - * @param extensions The extensions of the flag value. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return FlagValue.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[language=" - + Objects.toString(language, "") + ",value=" + value + ",extensions=" - + Objects.toString(extensions, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(language, extensions, value); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof FlagValue)) { - return false; - } - - FlagValue rhs = ((FlagValue) other); - return value == rhs.value && Objects.equals(language, rhs.language) - && Objects.equals(extensions, rhs.extensions); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("language", language) - .writeDoubleField("value", value) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes a FlagValue instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A FlagValue instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static FlagValue fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, FlagValue::new, (value, fieldName, reader) -> { - if ("language".equals(fieldName)) { - value.language = Languages.fromJson(reader); - } else if ("value".equals(fieldName)) { - value.value = reader.getDouble(); - } else if ("extensions".equals(fieldName)) { - value.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Header.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Header.java deleted file mode 100644 index 433e7201d9..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Header.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.model.extensionmodel.XmsExtensions; -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a header. - */ -public class Header implements JsonSerializable

{ - private String header; - private Schema schema; - private XmsExtensions extensions; - - /** - * Creates a new instance of the Header class. - */ - public Header() { - } - - /** - * Gets the name of the header. - * - * @return The name of the header. - */ - public String getHeader() { - return header; - } - - /** - * Sets the name of the header. - * - * @param header The name of the header. - */ - public void setHeader(String header) { - this.header = header; - } - - /** - * Gets the schema of the header. - * - * @return The schema of the header. - */ - public Schema getSchema() { - return schema; - } - - /** - * Sets the schema of the header. - * - * @param schema The schema of the header. - */ - public void setSchema(Schema schema) { - this.schema = schema; - } - - /** - * Gets the extensions of the header. - * - * @return The extensions of the header. - */ - public XmsExtensions getExtensions() { - return extensions; - } - - /** - * Sets the extensions of the header. - * - * @param extensions The extensions of the header. - */ - public void setExtensions(XmsExtensions extensions) { - this.extensions = extensions; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("header", header) - .writeJsonField("schema", schema) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes a Header instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Header instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Header fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Header::new, (header, fieldName, reader) -> { - if ("header".equals(fieldName)) { - header.header = reader.getString(); - } else if ("schema".equals(fieldName)) { - header.schema = Schema.fromJson(reader); - } else if ("extensions".equals(fieldName)) { - header.extensions = XmsExtensions.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Info.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Info.java deleted file mode 100644 index 825941baaf..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Info.java +++ /dev/null @@ -1,230 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents code model info. - */ -public class Info implements JsonSerializable { - private String title; - private String description; - private String termsOfService; - private Contact contact; - private License license; - private ExternalDocumentation externalDocs; - private DictionaryAny extensions; - - /** - * Creates a new instance of the Info class. - */ - public Info() { - } - - /** - * Gets the title of the service. (Required) - * - * @return The title of the service. - */ - public String getTitle() { - return title; - } - - /** - * Sets the title of the service. (Required) - * - * @param title The title of the service. - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Gets the description of the service. - * - * @return The description of the service. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the service. - * - * @param description The description of the service. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the URL of the terms of service. - * - * @return The URL of the terms of service. - */ - public String getTermsOfService() { - return termsOfService; - } - - /** - * Sets the URL of the terms of service. - * - * @param termsOfService The URL of the terms of service. - */ - public void setTermsOfService(String termsOfService) { - this.termsOfService = termsOfService; - } - - /** - * Gets the contact information. - * - * @return The contact information. - */ - public Contact getContact() { - return contact; - } - - /** - * Sets the contact information. - * - * @param contact The contact information. - */ - public void setContact(Contact contact) { - this.contact = contact; - } - - /** - * Gets the license information. - * - * @return The license information. - */ - public License getLicense() { - return license; - } - - /** - * Sets the license information. - * - * @param license The license information. - */ - public void setLicense(License license) { - this.license = license; - } - - /** - * Gets the reference to external documentation. - * - * @return The reference to external documentation. - */ - public ExternalDocumentation getExternalDocs() { - return externalDocs; - } - - /** - * Sets the reference to external documentation. - * - * @param externalDocs The reference to external documentation. - */ - public void setExternalDocs(ExternalDocumentation externalDocs) { - this.externalDocs = externalDocs; - } - - /** - * Gets the extensions of the service. - * - * @return The extensions of the service. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the extensions of the service. - * - * @param extensions The extensions of the service. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return Info.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[title=" - + Objects.toString(title, "") + ",description=" + Objects.toString(description, "") - + ",termsOfService=" + Objects.toString(termsOfService, "") + ",contact=" - + Objects.toString(contact, "") + ",license=" + Objects.toString(license, "") + ",externalDocs=" - + Objects.toString(externalDocs, "") + ",extensions=" + Objects.toString(extensions, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(license, extensions, contact, description, termsOfService, externalDocs, title); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof Info)) { - return false; - } - - Info rhs = ((Info) other); - return Objects.equals(title, rhs.title) && Objects.equals(description, rhs.description) - && Objects.equals(termsOfService, rhs.termsOfService) && Objects.equals(contact, rhs.contact) - && Objects.equals(license, rhs.license) && Objects.equals(externalDocs, rhs.externalDocs) - && Objects.equals(extensions, rhs.extensions); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("title", title) - .writeStringField("description", description) - .writeStringField("termsOfService", termsOfService) - .writeJsonField("contact", contact) - .writeJsonField("license", license) - .writeJsonField("externalDocs", externalDocs) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes an Info instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An Info instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Info fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Info::new, (info, fieldName, reader) -> { - if ("title".equals(fieldName)) { - info.title = reader.getString(); - } else if ("description".equals(fieldName)) { - info.description = reader.getString(); - } else if ("termsOfService".equals(fieldName)) { - info.termsOfService = reader.getString(); - } else if ("contact".equals(fieldName)) { - info.contact = Contact.fromJson(reader); - } else if ("license".equals(fieldName)) { - info.license = License.fromJson(reader); - } else if ("externalDocs".equals(fieldName)) { - info.externalDocs = ExternalDocumentation.fromJson(reader); - } else if ("extensions".equals(fieldName)) { - info.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/KnownMediaType.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/KnownMediaType.java deleted file mode 100644 index 603e08693d..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/KnownMediaType.java +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import java.util.HashMap; -import java.util.Map; - -/** - * Known media types. - */ -public enum KnownMediaType { - /** - * The media type is binary. - */ - BINARY("binary"), - - /** - * The media type is a form. - */ - FORM("form"), - - /** - * The media type is JSON. - */ - JSON("json"), - - /** - * The media type is multipart. - */ - MULTIPART("multipart"), - - /** - * The media type is text. - */ - TEXT("text"), - - /** - * The media type is unknown. - */ - UNKNOWN("unknown"), - - /** - * The media type is XML. - */ - XML("xml"); - - private final String value; - private final static Map CONSTANTS = new HashMap<>(); - - static { - for (KnownMediaType c: values()) { - CONSTANTS.put(c.value, c); - } - } - - KnownMediaType(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Get the string value of the KnownMediaType. - * - * @return The string value. - */ - public String value() { - return this.value; - } - - /** - * Get the KnownMediaType from a string value. - * - * @param value The string value. - * @return The KnownMediaType. - * @throws IllegalArgumentException If the string value doesn't correspond to a KnownMediaType. - */ - public static KnownMediaType fromValue(String value) { - KnownMediaType constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - /** - * Get the content type for the KnownMediaType. - * - * @return The content type. - */ - public String getContentType() { - switch (this) { - case BINARY: return "application/octet-stream"; - case FORM: return "application/x-www-form-urlencoded"; - case JSON: return "application/json"; - case MULTIPART: return "multipart/form-data"; - case TEXT: return "text/plain"; - case XML: return "application/xml"; - default: return JSON.getContentType(); - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Language.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Language.java deleted file mode 100644 index fd58b9e94c..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Language.java +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents the per-language metadata. - */ -public class Language implements JsonSerializable { - private String name; - private String serializedName; - private String description; - private String summary; - private String namespace; - private String comment; - - /** - * Creates a new instance of the Language class. - */ - public Language() { - } - - /** - * Gets the name used in actual implementation. (Required) - * - * @return The name used in actual implementation. - */ - public String getName() { - return name; - } - - /** - * Sets the name used in actual implementation. (Required) - * - * @param name The name used in actual implementation. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets the serialized name. - * - * @return The serialized name. - */ - public String getSerializedName() { - return serializedName; - } - - /** - * Sets the serialized name. - * - * @param serializedName The serialized name. - */ - public void setSerializedName(String serializedName) { - this.serializedName = serializedName; - } - - /** - * Gets the description. (Required) - * - * @return The description. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description. (Required) - * - * @param description The description. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the summary. - * - * @return The summary. - */ - public String getSummary() { - return summary; - } - - /** - * Sets the summary. - * - * @param summary The summary. - */ - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * Gets the namespace. - * - * @return The namespace. - */ - public String getNamespace() { - return namespace; - } - - /** - * Sets the namespace. - * - * @param namespace The namespace. - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * Gets the comment. - * - * @return The comment. - */ - public String getComment() { - return comment; - } - - /** - * Sets the comment. - * - * @param comment The comment. - */ - public void setComment(String comment) { - this.comment = comment; - } - - @Override - public String toString() { - return "Language{name='" + name + "', serializedName='" + serializedName + "'}"; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("name", name) - .writeStringField("serializedName", serializedName) - .writeStringField("description", description) - .writeStringField("summary", summary) - .writeStringField("namespace", namespace) - .writeStringField("comment", comment) - .writeEndObject(); - } - - /** - * Deserializes a Language instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Language instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Language fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, Language::new, (language, fieldName, reader) -> { - if ("name".equals(fieldName)) { - language.name = reader.getString(); - } else if ("serializedName".equals(fieldName)) { - language.serializedName = reader.getString(); - } else if ("description".equals(fieldName)) { - language.description = reader.getString(); - } else if ("summary".equals(fieldName)) { - language.summary = reader.getString(); - } else if ("namespace".equals(fieldName)) { - language.namespace = reader.getString(); - } else if ("comment".equals(fieldName)) { - language.comment = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Languages.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Languages.java deleted file mode 100644 index c4985b780a..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Languages.java +++ /dev/null @@ -1,362 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents all languages. - */ -public class Languages implements JsonSerializable { - private Language _default; - private CSharpLanguage csharp; - private Language python; - private Language ruby; - private Language go; - private Language typescript; - private Language javascript; - private Language powershell; - private Language java; - private Language c; - private Language cpp; - private Language swift; - private Language objectivec; - - /** - * Creates a new instance of the Languages class. - */ - public Languages() { - } - - /** - * Gets the default language. (Required) - * - * @return The default language. - */ - public Language getDefault() { - return _default; - } - - /** - * Sets the default language. (Required) - * - * @param _default The default language. - */ - public void setDefault(Language _default) { - this._default = _default; - } - - /** - * Gets the C# language. - * - * @return The C# language. - */ - public CSharpLanguage getCsharp() { - return csharp; - } - - /** - * Sets the C# language. - * - * @param csharp The C# language. - */ - public void setCsharp(CSharpLanguage csharp) { - this.csharp = csharp; - } - - /** - * Gets the Python language. - * - * @return The Python language. - */ - public Language getPython() { - return python; - } - - /** - * Sets the Python language. - * - * @param python The Python language. - */ - public void setPython(Language python) { - this.python = python; - } - - /** - * Gets the Ruby language. - * - * @return The Ruby language. - */ - public Language getRuby() { - return ruby; - } - - /** - * Sets the Ruby language. - * - * @param ruby The Ruby language. - */ - public void setRuby(Language ruby) { - this.ruby = ruby; - } - - /** - * Gets the Go language. - * - * @return The Go language. - */ - public Language getGo() { - return go; - } - - /** - * Sets the Go language. - * - * @param go The Go language. - */ - public void setGo(Language go) { - this.go = go; - } - - /** - * Gets the TypeScript language. - * - * @return The TypeScript language. - */ - public Language getTypescript() { - return typescript; - } - - /** - * Sets the TypeScript language. - * - * @param typescript The TypeScript language. - */ - public void setTypescript(Language typescript) { - this.typescript = typescript; - } - - /** - * Gets the JavaScript language. - * - * @return The JavaScript language. - */ - public Language getJavascript() { - return javascript; - } - - /** - * Sets the JavaScript language. - * - * @param javascript The JavaScript language. - */ - public void setJavascript(Language javascript) { - this.javascript = javascript; - } - - /** - * Gets the PowerShell language. - * - * @return The PowerShell language. - */ - public Language getPowershell() { - return powershell; - } - - /** - * Sets the PowerShell language. - * - * @param powershell The PowerShell language. - */ - public void setPowershell(Language powershell) { - this.powershell = powershell; - } - - /** - * Gets the Java language. - * - * @return The Java language. - */ - public Language getJava() { - return java; - } - - /** - * Sets the Java language. - * - * @param java The Java language. - */ - public void setJava(Language java) { - this.java = java; - } - - /** - * Gets the C language. - * - * @return The C language. - */ - public Language getC() { - return c; - } - - /** - * Sets the C language. - * - * @param c The C language. - */ - public void setC(Language c) { - this.c = c; - } - - /** - * Gets the C++ language. - * - * @return The C++ language. - */ - public Language getCpp() { - return cpp; - } - - /** - * Sets the C++ language. - * - * @param cpp The C++ language. - */ - public void setCpp(Language cpp) { - this.cpp = cpp; - } - - /** - * Gets the Swift language. - * - * @return The Swift language. - */ - public Language getSwift() { - return swift; - } - - /** - * Sets the Swift language. - * - * @param swift The Swift language. - */ - public void setSwift(Language swift) { - this.swift = swift; - } - - /** - * Gets the Objective-C language. - * - * @return The Objective-C language. - */ - public Language getObjectivec() { - return objectivec; - } - - /** - * Sets the Objective-C language. - * - * @param objectivec The Objective-C language. - */ - public void setObjectivec(Language objectivec) { - this.objectivec = objectivec; - } - - @Override - public int hashCode() { - return Objects.hash(_default, python, cpp, c, go, objectivec, javascript, ruby, csharp, java, powershell, - typescript, swift); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof Languages)) { - return false; - } - - Languages rhs = ((Languages) other); - return Objects.equals(_default, rhs._default) && Objects.equals(python, rhs.python) - && Objects.equals(cpp, rhs.cpp) && Objects.equals(c, rhs.c) && Objects.equals(go, rhs.go) - && Objects.equals(objectivec, rhs.objectivec) && Objects.equals(javascript, rhs.javascript) - && Objects.equals(ruby, rhs.ruby) && Objects.equals(csharp, rhs.csharp) && Objects.equals(java, rhs.java) - && Objects.equals(powershell, rhs.powershell) && Objects.equals(typescript, rhs.typescript) - && Objects.equals(swift, rhs.swift); - } - - @Override - public String toString() { - return "Languages{default=" + _default + ", java=" + java + '}'; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("default", _default) - .writeJsonField("csharp", csharp) - .writeJsonField("python", python) - .writeJsonField("ruby", ruby) - .writeJsonField("go", go) - .writeJsonField("typescript", typescript) - .writeJsonField("javascript", javascript) - .writeJsonField("powershell", powershell) - .writeJsonField("java", java) - .writeJsonField("c", c) - .writeJsonField("cpp", cpp) - .writeJsonField("swift", swift) - .writeJsonField("objectivec", objectivec) - .writeEndObject(); - } - - /** - * Deserializes a Languages instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Languages instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Languages fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, Languages::new, (languages, fieldName, reader) -> { - if ("_default".equals(fieldName)) { - languages._default = Language.fromJson(reader); - } else if ("csharp".equals(fieldName)) { - languages.csharp = CSharpLanguage.fromJson(reader); - } else if ("python".equals(fieldName)) { - languages.python = Language.fromJson(reader); - } else if ("ruby".equals(fieldName)) { - languages.ruby = Language.fromJson(reader); - } else if ("go".equals(fieldName)) { - languages.go = Language.fromJson(reader); - } else if ("typescript".equals(fieldName)) { - languages.typescript = Language.fromJson(reader); - } else if ("javascript".equals(fieldName)) { - languages.javascript = Language.fromJson(reader); - } else if ("powershell".equals(fieldName)) { - languages.powershell = Language.fromJson(reader); - } else if ("java".equals(fieldName)) { - languages.java = Language.fromJson(reader); - } else if ("c".equals(fieldName)) { - languages.c = Language.fromJson(reader); - } else if ("cpp".equals(fieldName)) { - languages.cpp = Language.fromJson(reader); - } else if ("swift".equals(fieldName)) { - languages.swift = Language.fromJson(reader); - } else if ("objectivec".equals(fieldName)) { - languages.objectivec = Language.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/License.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/License.java deleted file mode 100644 index 39dba08516..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/License.java +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents license information. - */ -public class License implements JsonSerializable { - private String name; - private String url; - private DictionaryAny extensions; - - /** - * Creates a new instance of the License class. - */ - public License() { - } - - /** - * The name of the license. (Required) - * - * @return The name of the license. - */ - public String getName() { - return name; - } - - /** - * Sets the name of the license. (Required) - * - * @param name The name of the license. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets the URL pointing to the full license text. - * - * @return The URL pointing to the full license text. - */ - public String getUrl() { - return url; - } - - /** - * Sets the URL pointing to the full license text. - * - * @param url The URL pointing to the full license text. - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * Gets the extensions of the license. - * - * @return The extensions of the license. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the extensions of the license. - * - * @param extensions The extensions of the license. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return License.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[name=" - + Objects.toString(name, "") + ",url=" + Objects.toString(url, "") + ",extensions=" - + Objects.toString(extensions, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(name, url, extensions); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof License)) { - return false; - } - - License rhs = ((License) other); - return Objects.equals(name, rhs.name) && Objects.equals(url, rhs.url) - && Objects.equals(extensions, rhs.extensions); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("name", name) - .writeStringField("url", url) - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes a License instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A License instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static License fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, License::new, (license, fieldName, reader) -> { - if ("name".equals(fieldName)) { - license.name = reader.getString(); - } else if ("url".equals(fieldName)) { - license.url = reader.getString(); - } else if ("extensions".equals(fieldName)) { - license.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/LongRunningMetadata.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/LongRunningMetadata.java deleted file mode 100644 index 3a130ed8d0..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/LongRunningMetadata.java +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents the metadata for long-running operations. - */ -public class LongRunningMetadata implements JsonSerializable { - private ObjectSchema pollResultType; - private ObjectSchema finalResultType; - private Metadata pollingStrategy; - private String finalResultPropertySerializedName; - - /** - * Creates a new instance of the LongRunningMetadata class. - */ - public LongRunningMetadata() { - } - - /** - * Gets the poll result type. - * - * @return The poll result type. - */ - public ObjectSchema getPollResultType() { - return pollResultType; - } - - /** - * Sets the poll result type. - * - * @param pollResultType The poll result type. - */ - public void setPollResultType(ObjectSchema pollResultType) { - this.pollResultType = pollResultType; - } - - /** - * Gets the final result type. - * - * @return The final result type. - */ - public ObjectSchema getFinalResultType() { - return finalResultType; - } - - /** - * Sets the final result type. - * - * @param finalResultType The final result type. - */ - public void setFinalResultType(ObjectSchema finalResultType) { - this.finalResultType = finalResultType; - } - - /** - * Gets the polling strategy. - * - * @return The polling strategy. - */ - public Metadata getPollingStrategy() { - return pollingStrategy; - } - - /** - * Sets the polling strategy. - * - * @param pollingStrategy The polling strategy. - */ - public void setPollingStrategy(Metadata pollingStrategy) { - this.pollingStrategy = pollingStrategy; - } - - /** - * Gets the serialized name for the property of final result. - * - * @return the serialized name for the property of final result. - */ - public String getFinalResultPropertySerializedName() { - return finalResultPropertySerializedName; - } - - /** - * Sets the serialized name for the property of final result. - * - * @param finalResultPropertySerializedName the serialized name for the property of final result. - */ - public void setFinalResultPropertySerializedName(String finalResultPropertySerializedName) { - this.finalResultPropertySerializedName = finalResultPropertySerializedName; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("pollResultType", pollResultType) - .writeJsonField("finalResultType", finalResultType) - .writeJsonField("pollingStrategy", pollingStrategy) - .writeStringField("finalResultPropertySerializedName", finalResultPropertySerializedName) - .writeEndObject(); - } - - /** - * Deserializes a LongRunningMetadata instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A LongRunningMetadata instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static LongRunningMetadata fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, LongRunningMetadata::new, (lroMetadata, fieldName, reader) -> { - if ("pollResultType".equals(fieldName)) { - lroMetadata.pollResultType = ObjectSchema.fromJson(reader); - } else if ("finalResultType".equals(fieldName)) { - lroMetadata.finalResultType = ObjectSchema.fromJson(reader); - } else if ("pollingStrategy".equals(fieldName)) { - lroMetadata.pollingStrategy = Metadata.fromJson(reader); - } else if ("finalResultPropertySerializedName".equals(fieldName)) { - lroMetadata.finalResultPropertySerializedName = reader.getFieldName(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Metadata.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Metadata.java deleted file mode 100644 index 47d8e9780c..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Metadata.java +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.model.extensionmodel.XmsExtensions; -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents metadata. - */ -public class Metadata implements JsonSerializable { - private Languages language; - private Protocols protocol; - private XmsExtensions extensions; - - /** - * Creates a new instance of the Metadata class. - */ - public Metadata() { - } - - /** - * Gets the language of the metadata. (Required) - * - * @return The language of the metadata. - */ - public Languages getLanguage() { - return language; - } - - /** - * Sets the language of the metadata. (Required) - * - * @param language The language of the metadata. - */ - public void setLanguage(Languages language) { - this.language = language; - } - - /** - * Gets the protocol of the metadata. (Required) - * - * @return The protocol of the metadata. - */ - public Protocols getProtocol() { - return protocol; - } - - /** - * Sets the protocol of the metadata. (Required) - * - * @param protocol The protocol of the metadata. - */ - public void setProtocol(Protocols protocol) { - this.protocol = protocol; - } - - /** - * Gets the extensions of the metadata. - * - * @return The extensions of the metadata. - */ - public XmsExtensions getExtensions() { - return extensions; - } - - /** - * Sets the extensions of the metadata. - * - * @param extensions The extensions of the metadata. - */ - public void setExtensions(XmsExtensions extensions) { - this.extensions = extensions; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return writeParentProperties(jsonWriter.writeStartObject()).writeEndObject(); - } - - JsonWriter writeParentProperties(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeJsonField("language", language) - .writeJsonField("protocol", protocol) - .writeJsonField("extensions", extensions); - } - - /** - * Deserializes a Metadata instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Metadata instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Metadata fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Metadata::new, (metadata, fieldName, reader) -> { - if (!metadata.tryConsumeParentProperties(metadata, fieldName, reader)) { - reader.skipChildren(); - } - }); - } - - boolean tryConsumeParentProperties(Metadata metadata, String fieldName, JsonReader reader) throws IOException { - if ("language".equals(fieldName)) { - metadata.language = Languages.fromJson(reader); - return true; - } else if ("protocol".equals(fieldName)) { - metadata.protocol = Protocols.fromJson(reader); - return true; - } else if ("extensions".equals(fieldName)) { - metadata.extensions = XmsExtensions.fromJson(reader); - return true; - } - return false; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/NotSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/NotSchema.java deleted file mode 100644 index 9b58054098..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/NotSchema.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a NOT relationship between schemas. - */ -public class NotSchema extends Schema { - private Schema not; - - /** - * Creates a new instance of the NotSchema class. - */ - public NotSchema() { - } - - /** - * Gets the schema that this may not be. (Required) - * - * @return The schema that this may not be. - */ - public Schema getNot() { - return not; - } - - /** - * Sets the schema that this may not be. (Required) - * - * @param not The schema that this may not be. - */ - public void setNot(Schema not) { - this.not = not; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("not", not) - .writeEndObject(); - } - - /** - * Deserializes a NotSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A NotSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static NotSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, NotSchema::new, (schema, fieldName, reader) -> { - if ("not".equals(fieldName)) { - schema.not = Schema.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/NumberSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/NumberSchema.java deleted file mode 100644 index 4a38ff3818..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/NumberSchema.java +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a Number value. - */ -public class NumberSchema extends PrimitiveSchema { - private double precision; - private double multipleOf; - private double maximum; - private boolean exclusiveMaximum; - private double minimum; - private boolean exclusiveMinimum; - private String encode; - - /** - * Creates a new instance of the NumberSchema class. - */ - public NumberSchema() { - } - - /** - * The precision of the number. (Required) - * - * @return The precision of the number. - */ - public double getPrecision() { - return precision; - } - - /** - * Sets the precision of the number. (Required) - * - * @param precision The precision of the number. - */ - public void setPrecision(double precision) { - this.precision = precision; - } - - /** - * Gets the multiple of this number must be, if set. - * - * @return The multiple of this number must be, if set. - */ - public double getMultipleOf() { - return multipleOf; - } - - /** - * Sets the multiple of this number must be, if set. - * - * @param multipleOf The multiple of this number must be, if set. - */ - public void setMultipleOf(double multipleOf) { - this.multipleOf = multipleOf; - } - - /** - * Gets the maximum value, if set. - * - * @return The maximum value, if set. - */ - public double getMaximum() { - return maximum; - } - - /** - * Sets the maximum value, if set. - * - * @param maximum The maximum value, if set. - */ - public void setMaximum(double maximum) { - this.maximum = maximum; - } - - /** - * Gets whether the maximum value is exclusive. - * - * @return Whether the maximum value is exclusive. - */ - public boolean isExclusiveMaximum() { - return exclusiveMaximum; - } - - /** - * Sets whether the maximum value is exclusive. - * - * @param exclusiveMaximum Whether the maximum value is exclusive. - */ - public void setExclusiveMaximum(boolean exclusiveMaximum) { - this.exclusiveMaximum = exclusiveMaximum; - } - - /** - * Gets the minimum value, if set. - * - * @return The minimum value, if set. - */ - public double getMinimum() { - return minimum; - } - - /** - * Sets the minimum value, if set. - * - * @param minimum The minimum value, if set. - */ - public void setMinimum(double minimum) { - this.minimum = minimum; - } - - /** - * Gets whether the minimum value is exclusive. - * - * @return Whether the minimum value is exclusive. - */ - public boolean isExclusiveMinimum() { - return exclusiveMinimum; - } - - /** - * Sets whether the minimum value is exclusive. - * - * @param exclusiveMinimum Whether the minimum value is exclusive. - */ - public void setExclusiveMinimum(boolean exclusiveMinimum) { - this.exclusiveMinimum = exclusiveMinimum; - } - - /** - * Gets the encode for the number. - * - * @return the encode for the number. - */ - public String getEncode() { - return encode; - } - - /** - * Sets the encode for the number. Currently only "string" is supported. - * - * @param encode the encode for the number. - */ - public void setEncode(String encode) { - this.encode = encode; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeDoubleField("precision", precision) - .writeDoubleField("multipleOf", multipleOf) - .writeDoubleField("maximum", maximum) - .writeBooleanField("exclusiveMaximum", exclusiveMaximum) - .writeDoubleField("minimum", minimum) - .writeBooleanField("exclusiveMinimum", exclusiveMinimum) - .writeStringField("encode", encode) - .writeEndObject(); - } - - /** - * Deserializes a NumberSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A NumberSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static NumberSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, NumberSchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - - if ("precision".equals(fieldName)) { - schema.precision = reader.getDouble(); - } else if ("multipleOf".equals(fieldName)) { - schema.multipleOf = reader.getDouble(); - } else if ("maximum".equals(fieldName)) { - schema.maximum = reader.getDouble(); - } else if ("exclusiveMaximum".equals(fieldName)) { - schema.exclusiveMaximum = reader.getBoolean(); - } else if ("minimum".equals(fieldName)) { - schema.minimum = reader.getDouble(); - } else if ("exclusiveMinimum".equals(fieldName)) { - schema.exclusiveMinimum = reader.getBoolean(); - } else if ("encode".equals(fieldName)) { - schema.encode = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ODataQuerySchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ODataQuerySchema.java deleted file mode 100644 index 15e166536b..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ODataQuerySchema.java +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents an ODataQuery value. - */ -public class ODataQuerySchema extends Schema { - - /** - * Creates a new instance of the ODataQuerySchema class. - */ - public ODataQuerySchema() { - } - - @Override - public String toString() { - return ODataQuerySchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof ODataQuerySchema; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes an ODataQuerySchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An ODataQuerySchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ODataQuerySchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ODataQuerySchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ObjectSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ObjectSchema.java deleted file mode 100644 index 3adf0902f1..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ObjectSchema.java +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents an object with child properties. - */ -public class ObjectSchema extends ComplexSchema { - private Discriminator discriminator; - private List properties = new ArrayList<>(); - private double maxProperties; - private double minProperties; - private Relations parents; - private Relations children; - private String discriminatorValue; - // internal use, not from modelerfour - private boolean flattenedSchema; - // internal use, not from modelerfour - private boolean stronglyTypedHeader; - private String crossLanguageDefinitionId; - - /** - * Creates a new instance of the ObjectSchema class. - */ - public ObjectSchema() { - } - - /** - * Gets the discriminator for this object. - * - * @return The discriminator for this object. - */ - public Discriminator getDiscriminator() { - return discriminator; - } - - /** - * Sets the discriminator for this object. - * - * @param discriminator The discriminator for this object. - */ - public void setDiscriminator(Discriminator discriminator) { - this.discriminator = discriminator; - } - - /** - * Gets the properties that are in this object. - * - * @return The properties that are in this object. - */ - public List getProperties() { - return properties; - } - - /** - * Sets the properties that are in this object. - * - * @param properties The properties that are in this object. - */ - public void setProperties(List properties) { - this.properties = properties; - } - - /** - * Gets the maximum number of properties permitted. - * - * @return The maximum number of properties permitted. - */ - public double getMaxProperties() { - return maxProperties; - } - - /** - * Sets the maximum number of properties permitted. - * - * @param maxProperties The maximum number of properties permitted. - */ - public void setMaxProperties(double maxProperties) { - this.maxProperties = maxProperties; - } - - /** - * Gets the minimum number of properties permitted. - * - * @return The minimum number of properties permitted. - */ - public double getMinProperties() { - return minProperties; - } - - /** - * Sets the minimum number of properties permitted. - * - * @param minProperties The minimum number of properties permitted. - */ - public void setMinProperties(double minProperties) { - this.minProperties = minProperties; - } - - /** - * Gets the parents of this object. - * - * @return The parents of this object. - */ - public Relations getParents() { - return parents; - } - - /** - * Sets the parents of this object. - * - * @param parents The parents of this object. - */ - public void setParents(Relations parents) { - this.parents = parents; - } - - /** - * Gets the children of this object. - * - * @return The children of this object. - */ - public Relations getChildren() { - return children; - } - - /** - * Sets the children of this object. - * - * @param children The children of this object. - */ - public void setChildren(Relations children) { - this.children = children; - } - - /** - * Gets the discriminator value for this object. - * - * @return The discriminator value for this object. - */ - public String getDiscriminatorValue() { - return discriminatorValue; - } - - /** - * Sets the discriminator value for this object. - * - * @param discriminatorValue The discriminator value for this object. - */ - public void setDiscriminatorValue(String discriminatorValue) { - this.discriminatorValue = discriminatorValue; - } - - /** - * Gets whether this schema represents a flattened schema. - * - * @return Whether this schema represents a flattened schema. - */ - public boolean isFlattenedSchema() { - return flattenedSchema; - } - - /** - * Sets whether this schema represents a flattened schema. - * - * @param flattenedSchema Whether this schema represents a flattened schema. - */ - public void setFlattenedSchema(boolean flattenedSchema) { - this.flattenedSchema = flattenedSchema; - } - - /** - * Gets whether this schema represents a strongly-typed HTTP headers object. - * - * @return Whether this schema represents a strongly-typed HTTP headers object. - */ - public boolean isStronglyTypedHeader() { - return stronglyTypedHeader; - } - - /** - * Sets whether this schema represents a strongly-typed HTTP headers object. - * - * @param stronglyTypedHeader Whether this schema represents a strongly-typed HTTP headers object. - */ - public void setStronglyTypedHeader(boolean stronglyTypedHeader) { - this.stronglyTypedHeader = stronglyTypedHeader; - } - - /** - * Gets the cross-language definition ID for this object. - * - * @return The cross-language definition ID for this object. - */ - public String getCrossLanguageDefinitionId() { - return crossLanguageDefinitionId; - } - - /** - * Sets the cross-language definition ID for this object. - * - * @param crossLanguageDefinitionId The cross-language definition ID for this object. - */ - public void setCrossLanguageDefinitionId(String crossLanguageDefinitionId) { - this.crossLanguageDefinitionId = crossLanguageDefinitionId; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeJsonField("discriminator", discriminator) - .writeArrayField("properties", properties, JsonWriter::writeJson) - .writeDoubleField("maxProperties", maxProperties) - .writeDoubleField("minProperties", minProperties) - .writeJsonField("parents", parents) - .writeJsonField("children", children) - .writeStringField("discriminatorValue", discriminatorValue) - .writeEndObject(); - } - - /** - * Deserializes an ObjectSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An ObjectSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ObjectSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ObjectSchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - - if ("discriminator".equals(fieldName)) { - schema.discriminator = Discriminator.fromJson(reader); - } else if ("properties".equals(fieldName)) { - schema.properties = reader.readArray(Property::fromJson); - } else if ("maxProperties".equals(fieldName)) { - schema.maxProperties = reader.getDouble(); - } else if ("minProperties".equals(fieldName)) { - schema.minProperties = reader.getDouble(); - } else if ("parents".equals(fieldName)) { - schema.parents = Relations.fromJson(reader); - } else if ("children".equals(fieldName)) { - schema.children = Relations.fromJson(reader); - } else if ("discriminatorValue".equals(fieldName)) { - schema.discriminatorValue = reader.getString(); - } else if ("flattenedSchema".equals(fieldName)) { - schema.flattenedSchema = reader.getBoolean(); - } else if ("stronglyTypedHeader".equals(fieldName)) { - schema.stronglyTypedHeader = reader.getBoolean(); - } else if ("crossLanguageDefinitionId".equals(fieldName)) { - schema.crossLanguageDefinitionId = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Operation.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Operation.java deleted file mode 100644 index 90f909749f..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Operation.java +++ /dev/null @@ -1,510 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a single callable endpoint with a discrete set of inputs, and any number of output possibilities - * (responses or exceptions). - */ -public class Operation extends Metadata { - private String operationId; - private List parameters = new ArrayList<>(); - private List signatureParameters = new ArrayList<>(); - private List requests; - private List responses = new ArrayList<>(); - private List exceptions = new ArrayList<>(); - private DictionaryApiVersion profile; - private String $key; - private String description; - private String uid; - private String summary; - private List apiVersions = new ArrayList<>(); - private Deprecation deprecated; - private ExternalDocumentation externalDocs; - private List specialHeaders; - private LongRunningMetadata lroMetadata; - private ConvenienceApi convenienceApi; - private Boolean generateProtocolApi; - private Boolean internalApi; - private String crossLanguageDefinitionId; - // internal - private OperationGroup operationGroup; - - /** - * Creates a new instance of the Operation class. - */ - public Operation() { - } - - /** - * Gets the operation ID. - * - * @return The operation ID. - */ - public String getOperationId() { - return operationId; - } - - /** - * Sets the operation ID. - * - * @param operationId The operation ID. - */ - public void setOperationId(String operationId) { - this.operationId = operationId; - } - - /** - * Gets the requests for this operation. (Required) - * - * @return The requests for this operation. - */ - public List getRequests() { - return requests; - } - - /** - * Sets the requests for this operation. (Required) - * - * @param requests The requests for this operation. - */ - public void setRequests(List requests) { - this.requests = requests; - } - - /** - * Gets the responses that indicate a successful call. - * - * @return The responses that indicate a successful call. - */ - public List getResponses() { - return responses; - } - - /** - * Sets the responses that indicate a successful call. - * - * @param responses The responses that indicate a successful call. - */ - public void setResponses(List responses) { - this.responses = responses; - } - - /** - * Gets the responses that indicate a failed call. - * - * @return The responses that indicate a failed call. - */ - public List getExceptions() { - return exceptions; - } - - /** - * Sets the responses that indicate a failed call. - * - * @param exceptions The responses that indicate a failed call. - */ - public void setExceptions(List exceptions) { - this.exceptions = exceptions; - } - - /** - * Gets the profile of the operation. - * - * @return The profile of the operation. - */ - public DictionaryApiVersion getProfile() { - return profile; - } - - /** - * Sets the profile of the operation. - * - * @param profile The profile of the operation. - */ - public void setProfile(DictionaryApiVersion profile) { - this.profile = profile; - } - - /** - * Gets the key of the operation. (Required) - * - * @return The key of the operation. - */ - public String get$key() { - return $key; - } - - /** - * Sets the key of the operation. (Required) - * - * @param $key The key of the operation. - */ - public void set$key(String $key) { - this.$key = $key; - } - - /** - * Gets the description of the operation. (Required) - * - * @return The description of the operation. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the operation. (Required) - * - * @param description The description of the operation. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the UID of the operation. (Required) - * - * @return The UID of the operation. - */ - public String getUid() { - return uid; - } - - /** - * Sets the UID of the operation. (Required) - * - * @param uid The UID of the operation. - */ - public void setUid(String uid) { - this.uid = uid; - } - - /** - * Gets the summary of the operation. - * - * @return The summary of the operation. - */ - public String getSummary() { - return summary; - } - - /** - * Sets the summary of the operation. - * - * @param summary The summary of the operation. - */ - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * Gets the API versions that this applies to. Undefined means all versions. - * - * @return The API versions that this applies to. Undefined means all versions. - */ - public List getApiVersions() { - return apiVersions; - } - - /** - * Sets the API versions that this applies to. Undefined means all versions. - * - * @param apiVersions The API versions that this applies to. Undefined means all versions. - */ - public void setApiVersions(List apiVersions) { - this.apiVersions = apiVersions; - } - - /** - * Gets the deprecation information for the operation. - * - * @return The deprecation information for the operation. - */ - public Deprecation getDeprecated() { - return deprecated; - } - - /** - * Sets the deprecation information for the operation. - * - * @param deprecated The deprecation information for the operation. - */ - public void setDeprecated(Deprecation deprecated) { - this.deprecated = deprecated; - } - - /** - * Gets a reference to external documentation. - * - * @return A reference to external documentation. - */ - public ExternalDocumentation getExternalDocs() { - return externalDocs; - } - - /** - * Sets a reference to external documentation. - * - * @param externalDocs A reference to external documentation. - */ - public void setExternalDocs(ExternalDocumentation externalDocs) { - this.externalDocs = externalDocs; - } - - /** - * Gets the operation group. - * - * @return The operation group. - */ - public OperationGroup getOperationGroup() { - return operationGroup; - } - - /** - * Sets the operation group. - * - * @param operationGroup The operation group. - */ - public void setOperationGroup(OperationGroup operationGroup) { - this.operationGroup = operationGroup; - } - - /** - * Gets the parameters for this operation. - * - * @return The parameters for this operation. - */ - public List getParameters() { - return parameters; - } - - /** - * Sets the parameters for this operation. - * - * @param parameters The parameters for this operation. - */ - public void setParameters(List parameters) { - this.parameters = parameters; - } - - /** - * Gets the signature parameters for this operation. - * - * @return The signature parameters for this operation. - */ - public List getSignatureParameters() { - return signatureParameters; - } - - /** - * Sets the signature parameters for this operation. - * - * @param signatureParameters The signature parameters for this operation. - */ - public void setSignatureParameters(List signatureParameters) { - this.signatureParameters = signatureParameters; - } - - /** - * Gets headers that require special processing, e.g. Repeatability-Request-ID - * - * @return Headers that require special processing, e.g. Repeatability-Request-ID - */ - public List getSpecialHeaders() { - return specialHeaders; - } - - /** - * Sets headers that require special processing, e.g. Repeatability-Request-ID - * - * @param specialHeaders Headers that require special processing, e.g. Repeatability-Request-ID - */ - public void setSpecialHeaders(List specialHeaders) { - this.specialHeaders = specialHeaders; - } - - /** - * Gets the metadata for long-running operations. - * - * @return The metadata for long-running operations. - */ - public LongRunningMetadata getLroMetadata() { - return lroMetadata; - } - - /** - * Sets the metadata for long-running operations. - * - * @param lroMetadata The metadata for long-running operations. - */ - public void setLroMetadata(LongRunningMetadata lroMetadata) { - this.lroMetadata = lroMetadata; - } - - /** - * Gets the convenience API. - * - * @return The convenience API. - */ - public ConvenienceApi getConvenienceApi() { - return convenienceApi; - } - - /** - * Sets the convenience API. - * - * @param convenienceApi The convenience API. - */ - public void setConvenienceApi(ConvenienceApi convenienceApi) { - this.convenienceApi = convenienceApi; - } - - /** - * Gets whether to generate protocol API. - * - * @return Whether to generate protocol API. - */ - public Boolean getGenerateProtocolApi() { - return generateProtocolApi; - } - - /** - * Sets whether to generate protocol API. - * - * @param generateProtocolApi Whether to generate protocol API. - */ - public void setGenerateProtocolApi(Boolean generateProtocolApi) { - this.generateProtocolApi = generateProtocolApi; - } - - /** - * Gets whether this is an internal API. - * - * @return Whether this is an internal API. - */ - public Boolean getInternalApi() { - return internalApi; - } - - /** - * Sets whether this is an internal API. - * - * @param internalApi Whether this is an internal API. - */ - public void setInternalApi(Boolean internalApi) { - this.internalApi = internalApi; - } - - /** - * Gets the cross-language definition ID. - * - * @return The cross-language definition ID. - */ - public String getCrossLanguageDefinitionId() { - return crossLanguageDefinitionId; - } - - /** - * Sets the cross-language definition ID. - * - * @param crossLanguageDefinitionId The cross-language definition ID. - */ - public void setCrossLanguageDefinitionId(String crossLanguageDefinitionId) { - this.crossLanguageDefinitionId = crossLanguageDefinitionId; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeStringField("operationId", operationId) - .writeArrayField("parameters", parameters, JsonWriter::writeJson) - .writeArrayField("signatureParameters", signatureParameters, JsonWriter::writeJson) - .writeArrayField("requests", requests, JsonWriter::writeJson) - .writeArrayField("responses", responses, JsonWriter::writeJson) - .writeArrayField("exceptions", exceptions, JsonWriter::writeJson) - .writeJsonField("profile", profile) - .writeStringField("$key", $key) - .writeStringField("description", description) - .writeStringField("uid", uid) - .writeStringField("summary", summary) - .writeArrayField("apiVersions", apiVersions, JsonWriter::writeJson) - .writeJsonField("deprecated", deprecated) - .writeJsonField("externalDocs", externalDocs) - .writeArrayField("specialHeaders", specialHeaders, JsonWriter::writeString) - .writeJsonField("lroMetadata", lroMetadata) - .writeJsonField("convenienceApi", convenienceApi) - .writeBooleanField("generateProtocolApi", generateProtocolApi) - .writeBooleanField("internalApi", internalApi) - .writeStringField("crossLanguageDefinitionId", crossLanguageDefinitionId) - .writeEndObject(); - } - - /** - * Deserializes an Operation instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An Operation instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Operation fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Operation::new, (operation, fieldName, reader) -> { - if (operation.tryConsumeParentProperties(operation, fieldName, reader)) { - return; - } - - if ("operationId".equals(fieldName)) { - operation.operationId = reader.getString(); - } else if ("parameters".equals(fieldName)) { - operation.parameters = reader.readArray(Parameter::fromJson); - } else if ("signatureParameters".equals(fieldName)) { - operation.signatureParameters = reader.readArray(Parameter::fromJson); - } else if ("requests".equals(fieldName)) { - operation.requests = reader.readArray(Request::fromJson); - } else if ("responses".equals(fieldName)) { - operation.responses = reader.readArray(Response::fromJson); - } else if ("exceptions".equals(fieldName)) { - operation.exceptions = reader.readArray(Response::fromJson); - } else if ("profile".equals(fieldName)) { - operation.profile = DictionaryApiVersion.fromJson(reader); - } else if ("$key".equals(fieldName)) { - operation.$key = reader.getString(); - } else if ("description".equals(fieldName)) { - operation.description = reader.getString(); - } else if ("uid".equals(fieldName)) { - operation.uid = reader.getString(); - } else if ("summary".equals(fieldName)) { - operation.summary = reader.getString(); - } else if ("apiVersions".equals(fieldName)) { - operation.apiVersions = reader.readArray(ApiVersion::fromJson); - } else if ("deprecated".equals(fieldName)) { - operation.deprecated = Deprecation.fromJson(reader); - } else if ("externalDocs".equals(fieldName)) { - operation.externalDocs = ExternalDocumentation.fromJson(reader); - } else if ("specialHeaders".equals(fieldName)) { - operation.specialHeaders = reader.readArray(JsonReader::getString); - } else if ("lroMetadata".equals(fieldName)) { - operation.lroMetadata = LongRunningMetadata.fromJson(reader); - } else if ("convenienceApi".equals(fieldName)) { - operation.convenienceApi = ConvenienceApi.fromJson(reader); - } else if ("generateProtocolApi".equals(fieldName)) { - operation.generateProtocolApi = reader.getBoolean(); - } else if ("internalApi".equals(fieldName)) { - operation.internalApi = reader.getBoolean(); - } else if ("crossLanguageDefinitionId".equals(fieldName)) { - operation.crossLanguageDefinitionId = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/OperationGroup.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/OperationGroup.java deleted file mode 100644 index a21afac2a1..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/OperationGroup.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents an operation group, a container around set of operations. - */ -public class OperationGroup extends Metadata { - private String $key; - private List operations = new ArrayList(); - private Client codeModel; - - /** - * Creates a new instance of the OperationGroup class. - */ - public OperationGroup() { - } - - /** - * Gets the key of the operation group. (Required) - * - * @return The key of the operation group. - */ - public String get$key() { - return $key; - } - - /** - * Sets the key of the operation group. (Required) - * - * @param $key The key of the operation group. - */ - public void set$key(String $key) { - this.$key = $key; - } - - /** - * Gets the operations that are in this operation group. (Required) - * - * @return The operations that are in this operation group. - */ - public List getOperations() { - return operations; - } - - /** - * Sets the operations that are in this operation group. (Required) - * - * @param operations The operations that are in this operation group. - */ - public void setOperations(List operations) { - this.operations = operations; - } - - /** - * Gets the client which contains the operation group. - * - * @return The client which contains the operation group. - */ - public Client getCodeModel() { - return codeModel; - } - - /** - * Sets the client which contains the operation group. - * - * @param codeModel The client which contains the operation group. - */ - public void setCodeModel(Client codeModel) { - this.codeModel = codeModel; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeStringField("$key", $key) - .writeArrayField("operations", operations, JsonWriter::writeJson) - .writeJsonField("codeModel", codeModel) - .writeEndObject(); - } - - /** - * Deserializes an OperationGroup instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An OperationGroup instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static OperationGroup fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, OperationGroup::new, (group, fieldName, reader) -> { - if (group.tryConsumeParentProperties(group, fieldName, reader)) { - return; - } - - if ("$key".equals(fieldName)) { - group.$key = reader.getString(); - } else if ("operations".equals(fieldName)) { - group.operations = reader.readArray(Operation::fromJson); - } else if ("codeModel".equals(fieldName)) { - group.codeModel = CodeModel.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/OrSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/OrSchema.java deleted file mode 100644 index 6c0f9b29e7..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/OrSchema.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * Represents an OR relationship between several schemas/ - */ -public class OrSchema extends ComplexSchema { - private List anyOf = new ArrayList<>(); - - /** - * Creates a new instance of the OrSchema class. - */ - public OrSchema() { - } - - /** - * Gets the set of schemas that this schema is composed of. Every schema is optional. (Required) - * - * @return The set of schemas that this schema is composed of. Every schema is optional. - */ - public List getAnyOf() { - return anyOf; - } - - /** - * Sets the set of schemas that this schema is composed of. Every schema is optional. (Required) - * - * @param anyOf The set of schemas that this schema is composed of. Every schema is optional. - */ - public void setAnyOf(List anyOf) { - this.anyOf = anyOf; - } - - @Override - public String toString() { - return OrSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[anyOf=" - + Objects.toString(anyOf, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(anyOf); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof OrSchema)) { - return false; - } - - OrSchema rhs = (OrSchema) other; - return Objects.equals(anyOf, rhs.anyOf); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("anyOf", anyOf, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes an OrSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An OrSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static OrSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, OrSchema::new, (schema, fieldName, reader) -> { - if ("anyOf".equals(fieldName)) { - schema.anyOf = reader.readArray(ObjectSchema::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Parameter.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Parameter.java deleted file mode 100644 index 7b714422b3..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Parameter.java +++ /dev/null @@ -1,297 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; - -/** - * Represents a discrete input for an operation. - */ -public class Parameter extends Value { - private String clientDefaultValue; - private Parameter.ImplementationLocation implementation; - private Operation operation; - private boolean flattened = false; - private Parameter originalParameter; - private Parameter groupedBy; - private Property targetProperty; - private String origin; - private String summary; - - /** - * Creates a new instance of the Parameter class. - */ - public Parameter() { - } - - /** - * Gets the default value for the parameter in the client. - * - * @return The default value for the parameter in the client. - */ - public String getClientDefaultValue() { - return clientDefaultValue; - } - - /** - * Sets the default value for the parameter in the client. - * - * @param clientDefaultValue The default value for the parameter in the client. - */ - public void setClientDefaultValue(String clientDefaultValue) { - this.clientDefaultValue = clientDefaultValue; - } - - /** - * Gets the location of the parameter's implementation. - * - * @return The location of the parameter's implementation. - */ - public Parameter.ImplementationLocation getImplementation() { - return implementation; - } - - /** - * Sets the location of the parameter's implementation. - * - * @param implementation The location of the parameter's implementation. - */ - public void setImplementation(Parameter.ImplementationLocation implementation) { - this.implementation = implementation; - } - - /** - * Gets the operation that this parameter is used in. - * - * @return The operation that this parameter is used in. - */ - public Operation getOperation() { - return operation; - } - - /** - * Sets the operation that this parameter is used in. - * - * @param operation The operation that this parameter is used in. - */ - public void setOperation(Operation operation) { - this.operation = operation; - } - - /** - * Gets whether the parameter is flattened. - * - * @return Whether the parameter is flattened. - */ - public boolean isFlattened() { - return flattened; - } - - /** - * Sets whether the parameter is flattened. - * - * @param hidden Whether the parameter is flattened. - */ - public void setFlattened(boolean hidden) { - this.flattened = hidden; - } - - /** - * Gets the original parameter that this parameter is derived from. - * - * @return The original parameter that this parameter is derived from. - */ - public Parameter getOriginalParameter() { - return originalParameter; - } - - /** - * Sets the original parameter that this parameter is derived from. - * - * @param originalParameter The original parameter that this parameter is derived from. - */ - public void setOriginalParameter(Parameter originalParameter) { - this.originalParameter = originalParameter; - } - - /** - * Gets the property that this parameter is targeting. - * - * @return The property that this parameter is targeting. - */ - public Property getTargetProperty() { - return targetProperty; - } - - /** - * Sets the property that this parameter is targeting. - * - * @param targetProperty The property that this parameter is targeting. - */ - public void setTargetProperty(Property targetProperty) { - this.targetProperty = targetProperty; - } - - /** - * Gets the parameter that this parameter is grouped by. - * - * @return The parameter that this parameter is grouped by. - */ - public Parameter getGroupedBy() { - return groupedBy; - } - - /** - * Sets the parameter that this parameter is grouped by. - * - * @param groupedBy The parameter that this parameter is grouped by. - */ - public void setGroupedBy(Parameter groupedBy) { - this.groupedBy = groupedBy; - } - - /** - * The origin of the parameter. - * - * @return The origin of the parameter. - */ - public String getOrigin() { - return origin; - } - - /** - * Sets the origin of the parameter. - * - * @param origin The origin of the parameter. - */ - public void setOrigin(String origin) { - this.origin = origin; - } - - @Override - public String getSummary() { - return summary; - } - - @Override - public void setSummary(String summary) { - this.summary = summary; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeStringField("clientDefaultValue", clientDefaultValue) - .writeStringField("implementation", implementation == null ? null : implementation.toString()) - .writeJsonField("operation", operation) - .writeBooleanField("flattened", flattened) - .writeJsonField("originalParameter", originalParameter) - .writeJsonField("groupedBy", groupedBy) - .writeJsonField("targetProperty", targetProperty) - .writeStringField("origin", origin) - .writeStringField("summary", summary) - .writeEndObject(); - } - - /** - * Deserializes a Parameter instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Parameter instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Parameter fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Parameter::new, (parameter, fieldName, reader) -> { - if (parameter.tryConsumeParentProperties(parameter, fieldName, reader)) { - return; - } - - if ("clientDefaultValue".equals(fieldName)) { - parameter.clientDefaultValue = reader.getString(); - } else if ("implementation".equals(fieldName)) { - parameter.implementation = ImplementationLocation.fromValue(reader.getString()); - } else if ("operation".equals(fieldName)) { - parameter.operation = Operation.fromJson(reader); - } else if ("flattened".equals(fieldName)) { - parameter.flattened = reader.getBoolean(); - } else if ("originalParameter".equals(fieldName)) { - parameter.originalParameter = Parameter.fromJson(reader); - } else if ("groupedBy".equals(fieldName)) { - parameter.groupedBy = Parameter.fromJson(reader); - } else if ("targetProperty".equals(fieldName)) { - parameter.targetProperty = Property.fromJson(reader); - } else if ("origin".equals(fieldName)) { - parameter.origin = reader.getString(); - } else if ("summary".equals(fieldName)) { - parameter.summary = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } - - /** - * The location of the parameter's implementation. - */ - public enum ImplementationLocation { - /** - * The parameter is implemented in the client. - */ - CLIENT("Client"), - - /** - * The parameter is implemented in the context. - */ - CONTEXT("Context"), - - /** - * The parameter is implemented in the method. - */ - METHOD("Method"); - private final String value; - - ImplementationLocation(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * The value of the location. - * - * @return The value of the location. - */ - public String value() { - return this.value; - } - - /** - * Parses a value to a location. - * - * @param value The value to parse. - * @return The parsed location. - * @throws IllegalArgumentException thrown if the value does not match any of the known locations. - */ - public static Parameter.ImplementationLocation fromValue(String value) { - if ("Client".equals(value)) { - return CLIENT; - } else if ("Context".equals(value)) { - return CONTEXT; - } else if ("Method".equals(value)) { - return METHOD; - } else { - throw new IllegalArgumentException(value); - } - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ParameterGroupSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ParameterGroupSchema.java deleted file mode 100644 index d8ca980a16..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ParameterGroupSchema.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * Represents a set of parameters. - */ -public class ParameterGroupSchema extends ComplexSchema { - private List parameters = new ArrayList<>(); - - /** - * Creates a new instance of the ParameterGroupSchema class. - */ - public ParameterGroupSchema() { - } - - /** - * Gets the collection of properties that are in this object. (Required) - * - * @return The collection of properties that are in this object. - */ - public List getParameters() { - return parameters; - } - - /** - * Sets the collection of properties that are in this object. (Required) - * - * @param parameters The collection of properties that are in this object. - */ - public void setParameters(List parameters) { - this.parameters = parameters; - } - - @Override - public String toString() { - return ParameterGroupSchema.class.getName() + '@' + Integer.toHexString(System.identityHashCode(this)) - + "[parameters=" + Objects.toString(parameters, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hashCode(parameters); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof ParameterGroupSchema)) { - return false; - } - - ParameterGroupSchema rhs = ((ParameterGroupSchema) other); - return Objects.equals(parameters, rhs.parameters); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("parameters", parameters, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a ParameterGroupSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ParameterGroupSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ParameterGroupSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ParameterGroupSchema::new, (relations, fieldName, reader) -> { - if ("parameters".equals(fieldName)) { - relations.parameters = reader.readArray(Parameter::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/PrimitiveSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/PrimitiveSchema.java deleted file mode 100644 index 60dcd3323a..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/PrimitiveSchema.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Schema types that are primitive language values - */ -public class PrimitiveSchema extends ValueSchema { - /** - * Creates a new instance of the PrimitiveSchema class. - */ - public PrimitiveSchema() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a PrimitiveSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A PrimitiveSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static PrimitiveSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, PrimitiveSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Property.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Property.java deleted file mode 100644 index 19f23d9a6b..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Property.java +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents a property that is a child value in an object. - */ -public class Property extends Value { - private boolean readOnly; - private String serializedName; - private boolean isDiscriminator; - private List flattenedNames; - private List originalParameter; - private String clientDefaultValue; - private String summary; - // internal use, not from modelerfour - private ObjectSchema parentSchema; - - /** - * Creates a new instance of the Property class. - */ - public Property() { - } - - /** - * Gets whether the property is read-only. - * - * @return Whether the property is read-only. - */ - public boolean isReadOnly() { - return readOnly; - } - - /** - * Sets whether the property is read-only. - * - * @param readOnly Whether the property is read-only. - */ - public void setReadOnly(boolean readOnly) { - this.readOnly = readOnly; - } - - /** - * Gets the wire name of this property. (Required) - * - * @return The wire name of this property. - */ - public String getSerializedName() { - return serializedName; - } - - /** - * Sets the wire name of this property. (Required) - * - * @param serializedName The wire name of this property. - */ - public void setSerializedName(String serializedName) { - this.serializedName = serializedName; - } - - /** - * Gets whether the property is used as a discriminator for a polymorphic type. - * - * @return Whether the property is used as a discriminator for a polymorphic type. - */ - public boolean isIsDiscriminator() { - return isDiscriminator; - } - - /** - * Sets whether the property is used as a discriminator for a polymorphic type. - * - * @param isDiscriminator Whether the property is used as a discriminator for a polymorphic type. - */ - public void setIsDiscriminator(boolean isDiscriminator) { - this.isDiscriminator = isDiscriminator; - } - - /** - * Gets the flattened names of this property. - * - * @return The flattened names of this property. - */ - public List getFlattenedNames() { - return flattenedNames; - } - - /** - * Sets the flattened names of this property. - * - * @param flattenedNames The flattened names of this property. - */ - public void setFlattenedNames(List flattenedNames) { - this.flattenedNames = flattenedNames; - } - - /** - * Gets the parent schema of this property. - * - * @return The parent schema of this property. - */ - public ObjectSchema getParentSchema() { - return parentSchema; - } - - /** - * Sets the parent schema of this property. - * - * @param parentSchema The parent schema of this property. - */ - public void setParentSchema(ObjectSchema parentSchema) { - this.parentSchema = parentSchema; - } - - /** - * Gets the original parameter that this property is derived from. - * - * @return The original parameter that this property is derived from. - */ - public List getOriginalParameter() { - return originalParameter; - } - - /** - * Sets the original parameter that this property is derived from. - * - * @param originalParameter The original parameter that this property is derived from. - */ - public void setOriginalParameter(List originalParameter) { - this.originalParameter = originalParameter; - } - - /** - * Gets the client default value of this property. - * - * @return The client default value of this property. - */ - public String getClientDefaultValue() { - return clientDefaultValue; - } - - /** - * Sets the client default value of this property. - * - * @param clientDefaultValue The client default value of this property. - */ - public void setClientDefaultValue(String clientDefaultValue) { - this.clientDefaultValue = clientDefaultValue; - } - - @Override - public String getSummary() { - return summary; - } - - @Override - public void setSummary(String summary) { - this.summary = summary; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeBooleanField("readOnly", readOnly) - .writeStringField("serializedName", serializedName) - .writeBooleanField("isDiscriminator", isDiscriminator) - .writeArrayField("flattenedNames", flattenedNames, JsonWriter::writeString) - .writeArrayField("originalParameter", originalParameter, JsonWriter::writeJson) - .writeStringField("clientDefaultValue", clientDefaultValue) - .writeStringField("summary", summary) - .writeEndObject(); - } - - /** - * Deserializes a Property instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Property instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Property fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Property::new, (property, fieldName, reader) -> { - if (property.tryConsumeParentProperties(property, fieldName, reader)) { - return; - } - - if ("readOnly".equals(fieldName)) { - property.readOnly = reader.getBoolean(); - } else if ("serializedName".equals(fieldName)) { - property.serializedName = reader.getString(); - } else if ("isDiscriminator".equals(fieldName)) { - property.isDiscriminator = reader.getBoolean(); - } else if ("flattenedNames".equals(fieldName)) { - property.flattenedNames = reader.readArray(JsonReader::getString); - } else if ("originalParameter".equals(fieldName)) { - property.originalParameter = reader.readArray(Parameter::fromJson); - } else if ("clientDefaultValue".equals(fieldName)) { - property.clientDefaultValue = reader.getString(); - } else if ("summary".equals(fieldName)) { - property.summary = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Protocol.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Protocol.java deleted file mode 100644 index 23807c5a3c..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Protocol.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents the per-protocol metadata on a given aspect. - */ -public class Protocol implements JsonSerializable { - private RequestParameterLocation in; - private String path; - private String uri; - private String method; - private KnownMediaType knownMediaType; - private SerializationStyle style; - private boolean explode; - private List mediaTypes; - private List servers; - private List statusCodes; - private List
headers; - - /** - * Creates a new instance of the Protocol class. - */ - public Protocol() { - } - - /** - * Gets the location of the parameter. - * - * @return The location of the parameter. - */ - public RequestParameterLocation getIn() { - return in; - } - - /** - * Sets the location of the parameter. - * - * @param in The location of the parameter. - */ - public void setIn(RequestParameterLocation in) { - this.in = in; - } - - /** - * Gets the path of the protocol. - * - * @return The path of the protocol. - */ - public String getPath() { - return path; - } - - /** - * Sets the path of the protocol. - * - * @param path The path of the protocol. - */ - public void setPath(String path) { - this.path = path; - } - - /** - * Gets the method of the protocol. - * - * @return The method of the protocol. - */ - public String getMethod() { - return method; - } - - /** - * Sets the method of the protocol. - * - * @param method The method of the protocol. - */ - public void setMethod(String method) { - this.method = method; - } - - /** - * Gets the known media type of the protocol. - * - * @return The known media type of the protocol. - */ - public KnownMediaType getKnownMediaType() { - return knownMediaType; - } - - /** - * Sets the known media type of the protocol. - * - * @param knownMediaType The known media type of the protocol. - */ - public void setKnownMediaType(KnownMediaType knownMediaType) { - this.knownMediaType = knownMediaType; - } - - /** - * Gets the servers of the protocol. - * - * @return The servers of the protocol. - */ - public List getServers() { - return servers; - } - - /** - * Sets the servers of the protocol. - * - * @param servers The servers of the protocol. - */ - public void setServers(List servers) { - this.servers = servers; - } - - /** - * Gets the media types of the protocol. - * - * @return The media types of the protocol. - */ - public List getMediaTypes() { - return mediaTypes; - } - - /** - * Sets the media types of the protocol. - * - * @param mediaTypes The media types of the protocol. - */ - public void setMediaTypes(List mediaTypes) { - this.mediaTypes = mediaTypes; - } - - /** - * Gets the status codes of the protocol. - * - * @return The status codes of the protocol. - */ - public List getStatusCodes() { - return statusCodes; - } - - /** - * Sets the status codes of the protocol. - * - * @param statusCodes The status codes of the protocol. - */ - public void setStatusCodes(List statusCodes) { - this.statusCodes = statusCodes; - } - - /** - * Gets the headers of the protocol. - * - * @return The headers of the protocol. - */ - public List
getHeaders() { - return headers; - } - - /** - * Sets the headers of the protocol. - * - * @param headers The headers of the protocol. - */ - public void setHeaders(List
headers) { - this.headers = headers; - } - - /** - * Gets the URI of the protocol. - * - * @return The URI of the protocol. - */ - public String getUri() { - return uri; - } - - /** - * Sets the URI of the protocol. - * - * @param uri The URI of the protocol. - */ - public void setUri(String uri) { - this.uri = uri; - } - - /** - * Gets the serialization style of the protocol. - * - * @return The serialization style of the protocol. - */ - public SerializationStyle getStyle() { - return style; - } - - /** - * Sets the serialization style of the protocol. - * - * @param style The serialization style of the protocol. - */ - public void setStyle(SerializationStyle style) { - this.style = style; - } - - /** - * Gets whether the protocol should be exploded. - * - * @return Whether the protocol should be exploded. - */ - public boolean getExplode() { - return explode; - } - - /** - * Sets whether the protocol should be exploded. - * - * @param explode Whether the protocol should be exploded. - */ - public void setExplode(boolean explode) { - this.explode = explode; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("in", in == null ? null : in.toString()) - .writeStringField("path", path) - .writeStringField("uri", uri) - .writeStringField("method", method) - .writeStringField("knownMediaType", knownMediaType == null ? null : knownMediaType.toString()) - .writeStringField("style", style == null ? null : style.toString()) - .writeBooleanField("explode", explode) - .writeArrayField("mediaTypes", mediaTypes, JsonWriter::writeString) - .writeArrayField("servers", servers, JsonWriter::writeJson) - .writeArrayField("statusCodes", statusCodes, JsonWriter::writeString) - .writeArrayField("headers", headers, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Protocol instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Protocol instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Protocol fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Protocol::new, (protocol, fieldName, reader) -> { - if ("in".equals(fieldName)) { - protocol.in = RequestParameterLocation.fromValue(reader.getString()); - } else if ("path".equals(fieldName)) { - protocol.path = reader.getString(); - } else if ("uri".equals(fieldName)) { - protocol.uri = reader.getString(); - } else if ("method".equals(fieldName)) { - protocol.method = reader.getString(); - } else if ("knownMediaType".equals(fieldName)) { - protocol.knownMediaType = KnownMediaType.fromValue(reader.getString()); - } else if ("style".equals(fieldName)) { - protocol.style = SerializationStyle.fromValue(reader.getString()); - } else if ("explode".equals(fieldName)) { - protocol.explode = reader.getBoolean(); - } else if ("mediaTypes".equals(fieldName)) { - protocol.mediaTypes = reader.readArray(JsonReader::getString); - } else if ("servers".equals(fieldName)) { - protocol.servers = reader.readArray(Server::fromJson); - } else if ("statusCodes".equals(fieldName)) { - protocol.statusCodes = reader.readArray(JsonReader::getString); - } else if ("headers".equals(fieldName)) { - protocol.headers = reader.readArray(Header::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Protocols.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Protocols.java deleted file mode 100644 index 228f3fd152..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Protocols.java +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents custom extensible metadata for individual protocols (ie, HTTP, etc), - */ -public class Protocols implements JsonSerializable { - private Protocol http; - private Protocol amqp; - private Protocol mqtt; - private Protocol jsonrpc; - - /** - * Creates a new instance of the Protocols class. - */ - public Protocols() { - } - - /** - * Gets the HTTP protocol. - * - * @return The HTTP protocol. - */ - public Protocol getHttp() { - return http; - } - - /** - * Sets the HTTP protocol. - * - * @param http The HTTP protocol. - */ - public void setHttp(Protocol http) { - this.http = http; - } - - /** - * Gets the AMQP protocol. - * - * @return The AMQP protocol. - */ - public Protocol getAmqp() { - return amqp; - } - - /** - * Sets the AMQP protocol. - * - * @param amqp The AMQP protocol. - */ - public void setAmqp(Protocol amqp) { - this.amqp = amqp; - } - - /** - * Gets the MQTT protocol. - * - * @return The MQTT protocol. - */ - public Protocol getMqtt() { - return mqtt; - } - - /** - * Sets the MQTT protocol. - * - * @param mqtt The MQTT protocol. - */ - public void setMqtt(Protocol mqtt) { - this.mqtt = mqtt; - } - - /** - * Gets the JSON-RPC protocol. - * - * @return The JSON-RPC protocol. - */ - public Protocol getJsonrpc() { - return jsonrpc; - } - - /** - * Sets the JSON-RPC protocol. - * - * @param jsonrpc The JSON-RPC protocol. - */ - public void setJsonrpc(Protocol jsonrpc) { - this.jsonrpc = jsonrpc; - } - - @Override - public String toString() { - return Protocols.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[http=" - + Objects.toString(http, "") + ",amqp=" + Objects.toString(amqp, "") + ",mqtt=" - + Objects.toString(mqtt, "") + ",jsonrpc=" + Objects.toString(jsonrpc, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(http, jsonrpc, amqp, mqtt); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof Protocols)) { - return false; - } - - Protocols rhs = ((Protocols) other); - return Objects.equals(http, rhs.http) && Objects.equals(jsonrpc, rhs.jsonrpc) && Objects.equals(amqp, rhs.amqp) - && Objects.equals(mqtt, rhs.mqtt); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("http", http) - .writeJsonField("amqp", amqp) - .writeJsonField("mqtt", mqtt) - .writeJsonField("jsonrpc", jsonrpc) - .writeEndObject(); - } - - /** - * Deserializes a Protocols instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Protocols instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Protocols fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Protocols::new, (protocols, fieldName, reader) -> { - if ("http".equals(fieldName)) { - protocols.http = Protocol.fromJson(reader); - } else if ("amqp".equals(fieldName)) { - protocols.amqp = Protocol.fromJson(reader); - } else if ("mqtt".equals(fieldName)) { - protocols.mqtt = Protocol.fromJson(reader); - } else if ("jsonrpc".equals(fieldName)) { - protocols.jsonrpc = Protocol.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Relations.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Relations.java deleted file mode 100644 index b13682a6d2..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Relations.java +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents relations between schemas. - */ -public class Relations implements JsonSerializable { - private List all; - private List immediate; - - /** - * Creates a new instance of the Relations class. - */ - public Relations() { - } - - /** - * Gets all schemas. - * - * @return The all schemas. - */ - public List getAll() { - return all; - } - - /** - * Sets all schemas. - * - * @param all The all schemas. - */ - public void setAll(List all) { - this.all = all; - } - - /** - * Gets immediate schemas. - * - * @return The immediate schemas. - */ - public List getImmediate() { - return immediate; - } - - /** - * Sets immediate schemas. - * - * @param immediate The immediate schemas. - */ - public void setImmediate(List immediate) { - this.immediate = immediate; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("all", all, JsonWriter::writeJson) - .writeArrayField("immediate", immediate, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Relations instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Relations instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Relations fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Relations::new, (relations, fieldName, reader) -> { - if ("all".equals(fieldName)) { - relations.all = reader.readArray(Schema::fromJson); - } else if ("immediate".equals(fieldName)) { - relations.immediate = reader.readArray(Schema::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Request.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Request.java deleted file mode 100644 index dc23dcd081..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Request.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a request to an operation. - */ -public class Request extends Metadata { - private List parameters = new ArrayList<>(); - private List signatureParameters = new ArrayList<>(); - - /** - * Creates a new instance of the Request class. - */ - public Request() { - } - - /** - * Gets the parameter inputs to the operation. - * - * @return The parameter inputs to the operation. - */ - public List getParameters() { - return parameters; - } - - /** - * Sets the parameter inputs to the operation. - * - * @param parameters The parameter inputs to the operation. - */ - public void setParameters(List parameters) { - this.parameters = parameters; - } - - /** - * Gets the signature parameters. - * - * @return The signature parameters. - */ - public List getSignatureParameters() { - return signatureParameters; - } - - /** - * Sets the signature parameters. - * - * @param signatureParameters The signature parameters. - */ - public void setSignatureParameters(List signatureParameters) { - this.signatureParameters = signatureParameters; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeArrayField("parameters", parameters, JsonWriter::writeJson) - .writeArrayField("signatureParameters", signatureParameters, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Request instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Request instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Request fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Request::new, (request, fieldName, reader) -> { - if (request.tryConsumeParentProperties(request, fieldName, reader)) { - return; - } - - if ("parameters".equals(fieldName)) { - request.parameters = reader.readArray(Parameter::fromJson); - } else if ("signatureParameters".equals(fieldName)) { - request.signatureParameters = reader.readArray(Parameter::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/RequestParameterLocation.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/RequestParameterLocation.java deleted file mode 100644 index 9b7123a96c..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/RequestParameterLocation.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import java.util.HashMap; -import java.util.Map; - -/** - * The location of a parameter within an HTTP request. - */ -public enum RequestParameterLocation { - /** - * The parameter is in the request body. - */ - BODY("body"), - - /** - * The parameter is in a cookie. - */ - COOKIE("cookie"), - - /** - * The parameter is in the request URI. - */ - URI("uri"), - - /** - * The parameter is in the request path. - */ - PATH("path"), - - /** - * The parameter is in the request header. - */ - HEADER("header"), - - /** - * The parameter is not in the request. - */ - NONE("none"), - - /** - * The parameter is in the request query. - */ - QUERY("query"); - - private final String value; - private final static Map CONSTANTS = new HashMap<>(); - - static { - for (RequestParameterLocation c : values()) { - CONSTANTS.put(c.value, c); - } - } - - RequestParameterLocation(String value) { - this.value = value; - } - - @Override - public String toString() { - if ("uri".equals(this.value)) { - return "host"; - } else { - return this.value; - } - } - - /** - * Gets the value of the parameter location. - * - * @return The value of the parameter location. - */ - public String value() { - return this.value; - } - - /** - * Returns the enum constant of this type with the specified value. - * - * @param value The value of the constant. - * @return The enum constant of this type with the specified value. - * @throws IllegalArgumentException If the specified value does not map to one of the constants in the enum. - */ - public static RequestParameterLocation fromValue(String value) { - RequestParameterLocation constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Response.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Response.java deleted file mode 100644 index 6f15e77a33..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Response.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a response from a service. - */ -public class Response extends Metadata { - private Schema schema; - private Boolean binary; - - /** - * Creates a new instance of the Response class. - */ - public Response() { - } - - /** - * Gets the schema of the response. - * - * @return The schema of the response. - */ - public Schema getSchema() { - return schema; - } - - /** - * Sets the schema of the response. - * - * @param schema The schema of the response. - */ - public void setSchema(Schema schema) { - this.schema = schema; - } - - /** - * Gets whether the response is binary. - * - * @return Whether the response is binary. - */ - public Boolean getBinary() { - return binary; - } - - /** - * Sets whether the response is binary. - * - * @param binary Whether the response is binary. - */ - public void setBinary(Boolean binary) { - this.binary = binary; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return writeParentProperties(jsonWriter.writeStartObject()).writeEndObject(); - } - - JsonWriter writeParentProperties(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter) - .writeJsonField("schema", schema) - .writeBooleanField("binary", binary); - } - - /** - * Deserializes a Response instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Response instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Response fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Response::new, (response, fieldName, reader) -> { - if (!response.tryConsumeParentProperties(response, fieldName, reader)) { - reader.skipChildren(); - } - }); - } - - boolean tryConsumeParentProperties(Response response, String fieldName, JsonReader reader) throws IOException { - if (super.tryConsumeParentProperties(response, fieldName, reader)) { - return true; - } else if ("schema".equals(fieldName)) { - response.schema = Schema.fromJson(reader); - return true; - } else if ("binary".equals(fieldName)) { - response.binary = reader.getNullable(JsonReader::getBoolean); - return true; - } - - return false; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioStep.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioStep.java deleted file mode 100644 index 257c26243b..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioStep.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Map; - -/** - * Represents a step in a scenario. - */ -public class ScenarioStep implements JsonSerializable { - private TestScenarioStepType type; - private String operationId; - private String exampleFile; - private String exampleName; - private Map requestParameters; - private String description; - - /** - * Creates a new instance of the ScenarioStep class. - */ - public ScenarioStep() { - } - - /** - * Gets the description of the step. - * - * @return The description of the step. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the step. - * - * @param description The description of the step. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the type of the step. - * - * @return The type of the step. - */ - public TestScenarioStepType getType() { - return type; - } - - /** - * Sets the type of the step. - * - * @param type The type of the step. - */ - public void setType(TestScenarioStepType type) { - this.type = type; - } - - /** - * Gets the operation id of the step. - * - * @return The operation id of the step. - */ - public String getOperationId() { - return operationId; - } - - /** - * Sets the operation id of the step. - * - * @param operationId The operation id of the step. - */ - public void setOperationId(String operationId) { - this.operationId = operationId; - } - - /** - * Gets the example file of the step. - * - * @return The example file of the step. - */ - public String getExampleFile() { - return exampleFile; - } - - /** - * Sets the example file of the step. - * - * @param exampleFile The example file of the step. - */ - public void setExampleFile(String exampleFile) { - this.exampleFile = exampleFile; - } - - /** - * Gets the example name of the step. - * - * @return The example name of the step. - */ - public String getExampleName() { - return exampleName; - } - - /** - * Sets the example name of the step. - * - * @param exampleName The example name of the step. - */ - public void setExampleName(String exampleName) { - this.exampleName = exampleName; - } - - /** - * Gets the request parameters of the step. - * - * @return The request parameters of the step. - */ - public Map getRequestParameters() { - return requestParameters; - } - - /** - * Sets the request parameters of the step. - * - * @param requestParameters The request parameters of the step. - */ - public void setRequestParameters(Map requestParameters) { - this.requestParameters = requestParameters; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("type", type == null ? null : type.toString()) - .writeStringField("operationId", operationId) - .writeStringField("exampleFile", exampleFile) - .writeStringField("exampleName", exampleName) - .writeMapField("requestParameters", requestParameters, JsonWriter::writeUntyped) - .writeStringField("description", description) - .writeEndObject(); - } - - /** - * Deserializes a ScenarioStep instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ScenarioStep instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ScenarioStep fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ScenarioStep::new, (step, fieldName, reader) -> { - if ("type".equals(fieldName)) { - step.type = TestScenarioStepType.fromValue(reader.getString()); - } else if ("operationId".equals(fieldName)) { - step.operationId = reader.getString(); - } else if ("exampleFile".equals(fieldName)) { - step.exampleFile = reader.getString(); - } else if ("exampleName".equals(fieldName)) { - step.exampleName = reader.getString(); - } else if ("requestParameters".equals(fieldName)) { - step.requestParameters = reader.readMap(JsonReader::readUntyped); - } else if ("description".equals(fieldName)) { - step.description = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioTest.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioTest.java deleted file mode 100644 index d6aad15ce6..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioTest.java +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * Represents a scenario test. - * - * @see - * Api Scenario Definition Reference - * - */ -public class ScenarioTest implements JsonSerializable { - private String filePath; - private List requiredVariables; - private Map requiredVariablesDefault; - private List scenarios; - private ScenarioTestScope scope; - private Boolean useArmTemplate; - - /** - * Creates a new instance of the ScenarioTest class. - */ - public ScenarioTest() { - } - - /** - * Gets the file path of the scenario test. - * - * @return The file path of the scenario test. - */ - @YamlProperty("_filePath") - public String getFilePath() { - return filePath; - } - - /** - * Sets the file path of the scenario test. - * - * @param filePath The file path of the scenario test. - */ - public void setFilePath(String filePath) { - this.filePath = filePath; - } - - /** - * Gets the required variables. - * - * @return The required variables. - */ - public List getRequiredVariables() { - return requiredVariables; - } - - /** - * Sets the required variables. - * - * @param requiredVariables The required variables. - */ - public void setRequiredVariables(List requiredVariables) { - this.requiredVariables = requiredVariables; - } - - /** - * Gets the default values for the required variables. - * - * @return The default values for the required variables. - */ - public Map getRequiredVariablesDefault() { - return requiredVariablesDefault; - } - - /** - * Sets the default values for the required variables. - * - * @param requiredVariablesDefault The default values for the required variables. - */ - public void setRequiredVariablesDefault(Map requiredVariablesDefault) { - this.requiredVariablesDefault = requiredVariablesDefault; - } - - /** - * Gets the scenarios. - * - * @return The scenarios. - */ - public List getScenarios() { - return scenarios; - } - - /** - * Sets the scenarios. - * - * @param scenarios The scenarios. - */ - public void setScenarios(List scenarios) { - this.scenarios = scenarios; - } - - /** - * Gets the scope of the scenario test. - * - * @return The scope of the scenario test. - */ - public ScenarioTestScope getScope() { - return scope; - } - - /** - * Sets the scope of the scenario test. - * - * @param scope The scope of the scenario test. - */ - public void setScope(ScenarioTestScope scope) { - this.scope = scope; - } - - /** - * Gets whether to use an ARM template. - * - * @return Whether to use an ARM template. - */ - public Boolean getUseArmTemplate() { - return useArmTemplate; - } - - /** - * Sets whether to use an ARM template. - * - * @param useArmTemplate Whether to use an ARM template. - */ - public void setUseArmTemplate(Boolean useArmTemplate) { - this.useArmTemplate = useArmTemplate; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("_filePath", filePath) - .writeArrayField("requiredVariables", requiredVariables, JsonWriter::writeString) - .writeMapField("requiredVariablesDefault", requiredVariablesDefault, JsonWriter::writeString) - .writeArrayField("scenarios", scenarios, JsonWriter::writeJson) - .writeStringField("scope", scope == null ? null : scope.toString()) - .writeBooleanField("useArmTemplate", useArmTemplate) - .writeEndObject(); - } - - /** - * Deserializes a ScenarioTest instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ScenarioTest instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ScenarioTest fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ScenarioTest::new, (test, fieldName, reader) -> { - if ("_filePath".equals(fieldName)) { - test.filePath = reader.getString(); - } else if ("requiredVariables".equals(fieldName)) { - test.requiredVariables = reader.readArray(JsonReader::getString); - } else if ("requiredVariablesDefault".equals(fieldName)) { - test.requiredVariablesDefault = reader.readMap(JsonReader::getString); - } else if ("scenarios".equals(fieldName)) { - test.scenarios = reader.readArray(TestScenario::fromJson); - } else if ("scope".equals(fieldName)) { - test.scope = ScenarioTestScope.fromValue(reader.getString()); - } else if ("useArmTemplate".equals(fieldName)) { - test.useArmTemplate = reader.getNullable(JsonReader::getBoolean); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioTestScope.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioTestScope.java deleted file mode 100644 index 5ae86a5860..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ScenarioTestScope.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -/** - * Represents the scope of a test scenario. - */ -public enum ScenarioTestScope { - - /** - * All the following API scenario and steps should be under some resourceGroup. It means: - * The consumer (API scenario runner or anything consumes API scenario) SHOULD maintain the resource group itself. - * Usually it requires user to input the subscriptionId/location, then it creates the resource group before test - * running, and deletes the resource group after running - * The consumer SHOULD set the following variables: - * - subscriptionId - * - resourceGroupName - * - location - */ - RESOURCE_GROUP("ResourceGroup"); - - private final String value; - - ScenarioTestScope(String value) { - this.value = value; - } - - /** - * Gets the ScenarioTestScope from its value. - * - * @param value The value. - * @return The ScenarioTestScope. - * @throws IllegalArgumentException If the value is invalid. - */ - public static ScenarioTestScope fromValue(String value) { - if ("ResourceGroup".equals(value)) { - return RESOURCE_GROUP; - } else { - throw new IllegalArgumentException(value); - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Schema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Schema.java deleted file mode 100644 index e7948738df..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Schema.java +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.model.extensionmodel.XmsExtensions; -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Represents a schema. - */ -public class Schema extends Metadata { - private Schema.AllSchemaTypes type; - private String summary; - private Object example; - private Object defaultValue; - private SerializationFormats serialization; - private Set serializationFormats; - private Set usage; - private String uid; - private String $key; - private String description; - private List apiVersions = new ArrayList<>(); - private Deprecation deprecated; - private ExternalDocumentation externalDocs; - - /** - * Creates a new instance of the Schema class. - */ - public Schema() { - } - - /** - * Gets the all schema types. (Required) - * - * @return The all schema types. - */ - public Schema.AllSchemaTypes getType() { - return type; - } - - /** - * Sets the all schema types. (Required) - * - * @param type The all schema types. - */ - public void setType(Schema.AllSchemaTypes type) { - this.type = type; - } - - /** - * Gets a short description. - * - * @return The short description. - */ - public String getSummary() { - return summary; - } - - /** - * Sets a short description. - * - * @param summary The short description. - */ - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * Gets example information. - * - * @return The example information. - */ - public Object getExample() { - return example; - } - - /** - * Sets example information. - * - * @param example The example information. - */ - public void setExample(Object example) { - this.example = example; - } - - /** - * Gets the default value. - * - * @return The default value. - */ - public Object getDefaultValue() { - return defaultValue; - } - - /** - * Sets the default value. - * - * @param defaultValue The default value. - */ - public void setDefaultValue(Object defaultValue) { - this.defaultValue = defaultValue; - } - - /** - * Gets the serialization formats. - * - * @return The serialization formats. - */ - public SerializationFormats getSerialization() { - return serialization; - } - - /** - * Sets the serialization formats. - * - * @param serialization The serialization formats. - */ - public void setSerialization(SerializationFormats serialization) { - this.serialization = serialization; - } - - /** - * Gets the set of serialization formats this Schema is used with, ex. JSON, XML, etc. - * - * @return The serialization formats. - */ - public Set getSerializationFormats() { - return serializationFormats; - } - - /** - * Sets the set of serialization formats this Schema is used with, ex. JSON, XML, etc. - * - * @param serializationFormats The serialization formats. - */ - public void setSerializationFormats(Set serializationFormats) { - this.serializationFormats = serializationFormats; - } - - /** - * Gets the UID of the schema. (Required) - * - * @return The UID of the schema. - */ - public String getUid() { - return uid; - } - - /** - * Sets the UID of the schema. (Required) - * - * @param uid The UID of the schema. - */ - public void setUid(String uid) { - this.uid = uid; - } - - /** - * Gets the key of the schema. (Required) - * - * @return The key of the schema. - */ - public String get$key() { - return $key; - } - - /** - * Sets the key of the schema. (Required) - * - * @param $key The key of the schema. - */ - public void set$key(String $key) { - this.$key = $key; - } - - /** - * Gets the description of the schema. (Required) - * - * @return The description of the schema. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the schema. (Required) - * - * @param description The description of the schema. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the API versions that this applies to. Undefined means all versions. - * - * @return The API versions that this applies to. Undefined means all versions. - */ - public List getApiVersions() { - return apiVersions; - } - - /** - * Sets the API versions that this applies to. Undefined means all versions. - * - * @param apiVersions The API versions that this applies to. Undefined means all versions. - */ - public void setApiVersions(List apiVersions) { - this.apiVersions = apiVersions; - } - - /** - * Gets the deprecation information for the schema. - * - * @return The deprecation information for the schema. - */ - public Deprecation getDeprecated() { - return deprecated; - } - - /** - * Sets the deprecation information for the schema. - * - * @param deprecated The deprecation information for the schema. - */ - public void setDeprecated(Deprecation deprecated) { - this.deprecated = deprecated; - } - - /** - * Gets a reference to external documentation. - * - * @return A reference to external documentation. - */ - public ExternalDocumentation getExternalDocs() { - return externalDocs; - } - - /** - * Sets a reference to external documentation. - * - * @param externalDocs A reference to external documentation. - */ - public void setExternalDocs(ExternalDocumentation externalDocs) { - this.externalDocs = externalDocs; - } - - /** - * Gets the usage of the schema. - * - * @return The usage of the schema. - */ - public Set getUsage() { - return usage; - } - - /** - * Sets the usage of the schema. - * - * @param usage The usage of the schema. - */ - public void setUsage(Set usage) { - this.usage = usage; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return writeParentProperties(jsonWriter.writeStartObject()).writeEndObject(); - } - - JsonWriter writeParentProperties(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter) - .writeStringField("type", type == null ? null : type.toString()) - .writeStringField("summary", summary) - .writeUntypedField("example", example) - .writeUntypedField("defaultValue", defaultValue) - .writeJsonField("serialization", serialization) - .writeArrayField("serializationFormats", serializationFormats, JsonWriter::writeString) - .writeArrayField("usage", usage, (writer, element) -> writer.writeString(element == null ? null : element.toString())) - .writeStringField("uid", uid) - .writeStringField("$key", $key) - .writeStringField("description", description) - .writeArrayField("apiVersions", apiVersions, JsonWriter::writeJson) - .writeJsonField("deprecated", deprecated) - .writeJsonField("externalDocs", externalDocs); - } - - /** - * Deserializes a Schema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Schema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Schema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Schema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } - - boolean tryConsumeParentProperties(Schema schema, String fieldName, JsonReader reader) throws IOException { - if (super.tryConsumeParentProperties(schema, fieldName, reader)) { - return true; - } else if ("type".equals(fieldName)) { - schema.type = Schema.AllSchemaTypes.fromValue(reader.getString()); - return true; - } else if ("summary".equals(fieldName)) { - schema.summary = reader.getString(); - return true; - } else if ("example".equals(fieldName)) { - schema.example = reader.readUntyped(); - return true; - } else if ("defaultValue".equals(fieldName)) { - schema.defaultValue = reader.readUntyped(); - return true; - } else if ("serialization".equals(fieldName)) { - schema.serialization = SerializationFormats.fromJson(reader); - return true; - } else if ("serializationFormats".equals(fieldName)) { - List formats = reader.readArray(JsonReader::getString); - schema.serializationFormats = formats == null ? null : new HashSet<>(formats); - return true; - } else if ("usage".equals(fieldName)) { - List usage = reader.readArray(element -> SchemaContext.fromValue(element.getString())); - schema.usage = usage == null ? null : new HashSet<>(usage); - return true; - } else if ("uid".equals(fieldName)) { - schema.uid = reader.getString(); - return true; - } else if ("$key".equals(fieldName)) { - schema.$key = reader.getString(); - return true; - } else if ("description".equals(fieldName)) { - schema.description = reader.getString(); - return true; - } else if ("apiVersions".equals(fieldName)) { - schema.apiVersions = reader.readArray(ApiVersion::fromJson); - return true; - } else if ("deprecated".equals(fieldName)) { - schema.deprecated = Deprecation.fromJson(reader); - return true; - } else if ("externalDocs".equals(fieldName)) { - schema.externalDocs = ExternalDocumentation.fromJson(reader); - return true; - } - - return false; - } - - /** - * Represents all schema types. - */ - public enum AllSchemaTypes { - /** - * Represents any type. - */ - ANY("any"), - - /** - * Represents any object. - */ - ANY_OBJECT("any-object"), - - /** - * Represents AND logic. - */ - AND("and"), - - /** - * Represents arm-id. - */ - ARM_ID("arm-id"), - - /** - * Represents array. - */ - ARRAY("array"), - - /** - * Represents binary. - */ - BINARY("binary"), - - /** - * Represents boolean. - */ - BOOLEAN("boolean"), - - /** - * Represents byte array. - */ - BYTE_ARRAY("byte-array"), - - /** - * Represents char. - */ - CHAR("char"), - - /** - * Represents choice. - */ - CHOICE("choice"), - - /** - * Represents constant. - */ - CONSTANT("constant"), - - /** - * Represents credential. - */ - CREDENTIAL("credential"), - - /** - * Represents date. - */ - DATE("date"), - - /** - * Represents date-time. - */ - DATE_TIME("date-time"), - - /** - * Represents dictionary. - */ - DICTIONARY("dictionary"), - - /** - * Represents duration. - */ - DURATION("duration"), - - /** - * Represents flag. - */ - FLAG("flag"), - - /** - * Represents float. - */ - GROUP("group"), - - /** - * Represents integer. - */ - INTEGER("integer"), - - /** - * Represents NOT logic. - */ - NOT("not"), - - /** - * Represents number. - */ - NUMBER("number"), - - /** - * Represents object. - */ - OBJECT("object"), - - /** - * Represents odata-query. - */ - ODATA_QUERY("odata-query"), - - /** - * Represents OR logic. - */ - OR("or"), - - /** - * Represents parameter-group. - */ - PARAMETER_GROUP("parameter-group"), - - /** - * Represents sealed-choice. - */ - SEALED_CHOICE("sealed-choice"), - - /** - * Represents string. - */ - STRING("string"), - - /** - * Represents time. - */ - TIME("time"), - - /** - * Represents unixtime. - */ - UNIXTIME("unixtime"), - - /** - * Represents uri. - */ - URI("uri"), - - /** - * Represents uuid. - */ - UUID("uuid"), - - /** - * Represents XOR logic. - */ - XOR("xor"); - private final String value; - private final static Map CONSTANTS = new HashMap<>(); - - static { - for (Schema.AllSchemaTypes c : values()) { - CONSTANTS.put(c.value, c); - } - } - - AllSchemaTypes(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Gets the value of the schema type. - * - * @return The value of the schema type. - */ - public String value() { - return this.value; - } - - /** - * Returns the enum constant of this type with the specified value. - * - * @param value The value of the constant. - * @return The enum constant of this type with the specified value. - * @throws IllegalArgumentException If the specified value does not map to one of the constants in the enum. - */ - public static Schema.AllSchemaTypes fromValue(String value) { - Schema.AllSchemaTypes constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } - - } - -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SchemaContext.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SchemaContext.java deleted file mode 100644 index dc340cf8c0..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SchemaContext.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import java.util.HashMap; -import java.util.Map; - -/** - * The context in which a schema is used. - */ -public enum SchemaContext { - /** - * The schema is used as an input. - */ - INPUT("input"), - - /** - * The schema is used as an output. - */ - OUTPUT("output"), - - /** - * The schema is used as an exception. - */ - EXCEPTION("exception"), - - /** - * The schema is used publicly. - */ - PUBLIC("public"), - - /** - * The schema is used as a paged result. - */ - PAGED("paged"), - - /** - * The schema is used internally. - */ - INTERNAL("internal"), - - /** - * The schema is used as a JSON merge patch. - */ - JSON_MERGE_PATCH("json-merge-patch"), - - /** - * The schema is used as options group. - */ - OPTIONS_GROUP("options-group"); - - private final String value; - private final static Map CONSTANTS = new HashMap<>(); - - static { - for (SchemaContext c : values()) { - CONSTANTS.put(c.value, c); - } - } - - SchemaContext(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Gets the value of the schema context. - * - * @return The value of the schema context. - */ - public String value() { - return this.value; - } - - /** - * Returns the enum constant of this type with the specified value. - * - * @param value The value of the constant. - * @return The enum constant of this type with the specified value. - * @throws IllegalArgumentException If the specified value does not map to one of the constants in the enum. - */ - public static SchemaContext fromValue(String value) { - SchemaContext constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SchemaResponse.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SchemaResponse.java deleted file mode 100644 index 7a24a46660..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SchemaResponse.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a response from a service. - */ -public class SchemaResponse extends Response { - private Schema schema; - - /** - * Creates a new instance of the SchemaResponse class. - */ - public SchemaResponse() { - } - - /** - * Gets the schema of the response. - * - * @return The schema of the response. - */ - public Schema getSchema() { - return schema; - } - - /** - * Sets the schema of the response. - * - * @param schema The schema of the response. - */ - public void setSchema(Schema schema) { - this.schema = schema; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeJsonField("schema", schema) - .writeEndObject(); - } - - /** - * Deserializes a SchemaResponse instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A SchemaResponse instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static SchemaResponse fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, SchemaResponse::new, (response, fieldName, reader) -> { - if (response.tryConsumeParentProperties(response, fieldName, reader)) { - return; - } - - if ("schema".equals(fieldName)) { - response.schema = Schema.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Schemas.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Schemas.java deleted file mode 100644 index 60ebde38b4..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Schemas.java +++ /dev/null @@ -1,662 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents the full set of schemas for a given service, categorized into convenient collections. - */ -public class Schemas implements JsonSerializable { - private List arrays = new ArrayList<>(); - private List dictionaries = new ArrayList<>(); - private List binaries = new ArrayList<>(); - private List groups = new ArrayList<>(); - private List booleans = new ArrayList<>(); - private List numbers = new ArrayList<>(); - private List objects = new ArrayList<>(); - private List strings = new ArrayList<>(); - private List unixtimes = new ArrayList<>(); - private List byteArrays = new ArrayList<>(); - private List streams = new ArrayList<>(); - private List chars = new ArrayList<>(); - private List dates = new ArrayList<>(); - private List dateTimes = new ArrayList<>(); - private List durations = new ArrayList<>(); - private List uuids = new ArrayList<>(); - private List uris = new ArrayList<>(); - private List credentials = new ArrayList<>(); - private List odataQueries = new ArrayList<>(); - private List choices = new ArrayList<>(); - private List sealedChoices = new ArrayList<>(); - private List flags = new ArrayList<>(); - private List constants = new ArrayList<>(); - private List ands = new ArrayList<>(); - private List ors = new ArrayList<>(); - private List xors = new ArrayList<>(); - private List unknowns = new ArrayList<>(); - private List parameterGroups = new ArrayList<>(); - - /** - * Creates a new instance of the Schemas class. - */ - public Schemas() { - } - - /** - * Gets the list of array schemas. - * - * @return The list of array schemas. - */ - public List getArrays() { - return arrays; - } - - /** - * Sets the list of array schemas. - * - * @param arrays The list of array schemas. - */ - public void setArrays(List arrays) { - this.arrays = arrays; - } - - /** - * Gets the list of dictionary schemas. - * - * @return The list of dictionary schemas. - */ - public List getDictionaries() { - return dictionaries; - } - - /** - * Sets the list of dictionary schemas. - * - * @param dictionaries The list of dictionary schemas. - */ - public void setDictionaries(List dictionaries) { - this.dictionaries = dictionaries; - } - - /** - * Gets the list of boolean schemas. - * - * @return The list of boolean schemas. - */ - public List getBooleans() { - return booleans; - } - - /** - * Sets the list of boolean schemas. - * - * @param booleans The list of boolean schemas. - */ - public void setBooleans(List booleans) { - this.booleans = booleans; - } - - /** - * Gets the list of number schemas. - * - * @return The list of number schemas. - */ - public List getNumbers() { - return numbers; - } - - /** - * Sets the list of number schemas. - * - * @param numbers The list of number schemas. - */ - public void setNumbers(List numbers) { - this.numbers = numbers; - } - - /** - * Gets the list of object schemas. - * - * @return The list of object schemas. - */ - public List getObjects() { - return objects; - } - - /** - * Sets the list of object schemas. - * - * @param objects The list of object schemas. - */ - public void setObjects(List objects) { - this.objects = objects; - } - - /** - * Gets the list of string schemas. - * - * @return The list of string schemas. - */ - public List getStrings() { - return strings; - } - - /** - * Sets the list of string schemas. - * - * @param strings The list of string schemas. - */ - public void setStrings(List strings) { - this.strings = strings; - } - - /** - * Gets the list of UnixTime schemas. - * - * @return The list of UnixTime schemas. - */ - public List getUnixtimes() { - return unixtimes; - } - - /** - * Sets the list of UnixTime schemas. - * - * @param unixtimes The list of UnixTime schemas. - */ - public void setUnixtimes(List unixtimes) { - this.unixtimes = unixtimes; - } - - /** - * Gets the list of ByteArray schemas. - * - * @return The list of ByteArray schemas. - */ - public List getByteArrays() { - return byteArrays; - } - - /** - * Sets the list of ByteArray schemas. - * - * @param byteArrays The list of ByteArray schemas. - */ - public void setByteArrays(List byteArrays) { - this.byteArrays = byteArrays; - } - - /** - * Gets the list of streams. - * - * @return The list of streams. - */ - public List getStreams() { - return streams; - } - - /** - * Sets the list of streams. - * - * @param streams The list of streams. - */ - public void setStreams(List streams) { - this.streams = streams; - } - - /** - * Gets the list of Char schemas. - * - * @return The list of Char schemas. - */ - public List getChars() { - return chars; - } - - /** - * Sets the list of Char schemas. - * - * @param chars The list of Char schemas. - */ - public void setChars(List chars) { - this.chars = chars; - } - - /** - * Gets the list of Date schemas. - * - * @return The list of Date schemas. - */ - public List getDates() { - return dates; - } - - /** - * Sets the list of Date schemas. - * - * @param dates The list of Date schemas. - */ - public void setDates(List dates) { - this.dates = dates; - } - - /** - * Gets the list of DateTime schemas. - * - * @return The list of DateTime schemas. - */ - public List getDateTimes() { - return dateTimes; - } - - /** - * Sets the list of DateTime schemas. - * - * @param dateTimes The list of DateTime schemas. - */ - public void setDateTimes(List dateTimes) { - this.dateTimes = dateTimes; - } - - /** - * Gets the list of Duration schemas. - * - * @return The list of Duration schemas. - */ - public List getDurations() { - return durations; - } - - /** - * Sets the list of Duration schemas. - * - * @param durations The list of Duration schemas. - */ - public void setDurations(List durations) { - this.durations = durations; - } - - /** - * Gets the list of Uuid schemas. - * - * @return The list of Uuid schemas. - */ - public List getUuids() { - return uuids; - } - - /** - * Sets the list of Uuid schemas. - * - * @param uuids The list of Uuid schemas. - */ - public void setUuids(List uuids) { - this.uuids = uuids; - } - - /** - * Gets the list of Uri schemas. - * - * @return The list of Uri schemas. - */ - public List getUris() { - return uris; - } - - /** - * Sets the list of Uri schemas. - * - * @param uris The list of Uri schemas. - */ - public void setUris(List uris) { - this.uris = uris; - } - - /** - * Gets the list of Credential schemas. - * - * @return The list of Credential schemas. - */ - public List getCredentials() { - return credentials; - } - - /** - * Sets the list of Credential schemas. - * - * @param credentials The list of Credential schemas. - */ - public void setCredentials(List credentials) { - this.credentials = credentials; - } - - /** - * Gets the list of ODataQuery schemas. - * - * @return The list of ODataQuery schemas. - */ - public List getOdataQueries() { - return odataQueries; - } - - /** - * Sets the list of ODataQuery schemas. - * - * @param odataQueries The list of ODataQuery schemas. - */ - public void setOdataQueries(List odataQueries) { - this.odataQueries = odataQueries; - } - - /** - * Gets the list of Choice schemas. - * - * @return The list of Choice schemas. - */ - public List getChoices() { - return choices; - } - - /** - * Sets the list of Choice schemas. - * - * @param choices The list of Choice schemas. - */ - public void setChoices(List choices) { - this.choices = choices; - } - - /** - * Gets the list of SealedChoice schemas. - * - * @return The list of SealedChoice schemas. - */ - public List getSealedChoices() { - return sealedChoices; - } - - /** - * Sets the list of SealedChoice schemas. - * - * @param sealedChoices The list of SealedChoice schemas. - */ - public void setSealedChoices(List sealedChoices) { - this.sealedChoices = sealedChoices; - } - - /** - * Gets the list of Flag schemas. - * - * @return The list of Flag schemas. - */ - public List getFlags() { - return flags; - } - - /** - * Sets the list of Flag schemas. - * - * @param flags The list of Flag schemas. - */ - public void setFlags(List flags) { - this.flags = flags; - } - - /** - * Gets the list of Constant schemas. - * - * @return The list of Constant schemas. - */ - public List getConstants() { - return constants; - } - - /** - * Sets the list of Constant schemas. - * - * @param constants The list of Constant schemas. - */ - public void setConstants(List constants) { - this.constants = constants; - } - - /** - * Gets the list of And schemas. - * - * @return The list of And schemas. - */ - public List getAnds() { - return ands; - } - - /** - * Sets the list of And schemas. - * - * @param ands The list of And schemas. - */ - public void setAnds(List ands) { - this.ands = ands; - } - - /** - * Gets the list of Or schemas. - * - * @return The list of Or schemas. - */ - public List getOrs() { - return ors; - } - - /** - * Sets the list of Or schemas. - * - * @param ors The list of Or schemas. - */ - public void setOrs(List ors) { - this.ors = ors; - } - - /** - * Gets the list of Xor schemas. - * - * @return The list of Xor schemas. - */ - public List getXors() { - return xors; - } - - /** - * Sets the list of Xor schemas. - * - * @param xors The list of Xor schemas. - */ - public void setXors(List xors) { - this.xors = xors; - } - - /** - * Gets the list of unknown schemas. - * - * @return The list of unknown schemas. - */ - public List getUnknowns() { - return unknowns; - } - - /** - * Sets the list of unknown schemas. - * - * @param unknowns The list of unknown schemas. - */ - public void setUnknowns(List unknowns) { - this.unknowns = unknowns; - } - - /** - * Gets the list of parameter group schemas. - * - * @return The list of parameter group schemas. - */ - public List getParameterGroups() { - return parameterGroups; - } - - /** - * Sets the list of parameter group schemas. - * - * @param parameterGroups The list of parameter group schemas. - */ - public void setParameterGroups(List parameterGroups) { - this.parameterGroups = parameterGroups; - } - - /** - * Gets the list of group schemas. - * - * @return The list of group schemas. - */ - public List getGroups() { - return groups; - } - - /** - * Sets the list of group schemas. - * - * @param groups The list of group schemas. - */ - public void setGroups(List groups) { - this.groups = groups; - } - - /** - * Gets the list of binary schemas. - * - * @return The list of binary schemas. - */ - public List getBinaries() { - return binaries; - } - - /** - * Sets the list of binary schemas. - * - * @param binaries The list of binary schemas. - */ - public void setBinaries(List binaries) { - this.binaries = binaries; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("arrays", arrays, JsonWriter::writeJson) - .writeArrayField("dictionaries", dictionaries, JsonWriter::writeJson) - .writeArrayField("binaries", binaries, JsonWriter::writeJson) - .writeArrayField("groups", groups, JsonWriter::writeJson) - .writeArrayField("booleans", booleans, JsonWriter::writeJson) - .writeArrayField("numbers", numbers, JsonWriter::writeJson) - .writeArrayField("objects", objects, JsonWriter::writeJson) - .writeArrayField("strings", strings, JsonWriter::writeJson) - .writeArrayField("unixtimes", unixtimes, JsonWriter::writeJson) - .writeArrayField("byteArrays", byteArrays, JsonWriter::writeJson) - .writeArrayField("streams", streams, JsonWriter::writeJson) - .writeArrayField("chars", chars, JsonWriter::writeJson) - .writeArrayField("dates", dates, JsonWriter::writeJson) - .writeArrayField("dateTimes", dateTimes, JsonWriter::writeJson) - .writeArrayField("durations", durations, JsonWriter::writeJson) - .writeArrayField("uuids", uuids, JsonWriter::writeJson) - .writeArrayField("uris", uris, JsonWriter::writeJson) - .writeArrayField("credentials", credentials, JsonWriter::writeJson) - .writeArrayField("odataQueries", odataQueries, JsonWriter::writeJson) - .writeArrayField("choices", choices, JsonWriter::writeJson) - .writeArrayField("sealedChoices", sealedChoices, JsonWriter::writeJson) - .writeArrayField("flags", flags, JsonWriter::writeJson) - .writeArrayField("constants", constants, JsonWriter::writeJson) - .writeArrayField("ands", ands, JsonWriter::writeJson) - .writeArrayField("ors", ors, JsonWriter::writeJson) - .writeArrayField("xors", xors, JsonWriter::writeJson) - .writeArrayField("unknowns", unknowns, JsonWriter::writeJson) - .writeArrayField("parameterGroups", parameterGroups, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Schemas instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Schemas instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Schemas fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Schemas::new, (schemas, fieldName, reader) -> { - if ("arrays".equals(fieldName)) { - schemas.arrays = reader.readArray(ArraySchema::fromJson); - } else if ("dictionaries".equals(fieldName)) { - schemas.dictionaries = reader.readArray(DictionarySchema::fromJson); - } else if ("binaries".equals(fieldName)) { - schemas.binaries = reader.readArray(BinarySchema::fromJson); - } else if ("groups".equals(fieldName)) { - schemas.groups = reader.readArray(ObjectSchema::fromJson); - } else if ("booleans".equals(fieldName)) { - schemas.booleans = reader.readArray(BooleanSchema::fromJson); - } else if ("numbers".equals(fieldName)) { - schemas.numbers = reader.readArray(NumberSchema::fromJson); - } else if ("objects".equals(fieldName)) { - schemas.objects = reader.readArray(ObjectSchema::fromJson); - } else if ("strings".equals(fieldName)) { - schemas.strings = reader.readArray(StringSchema::fromJson); - } else if ("unixtimes".equals(fieldName)) { - schemas.unixtimes = reader.readArray(UnixTimeSchema::fromJson); - } else if ("byteArrays".equals(fieldName)) { - schemas.byteArrays = reader.readArray(ByteArraySchema::fromJson); - } else if ("streams".equals(fieldName)) { - schemas.streams = reader.readArray(Schema::fromJson); - } else if ("chars".equals(fieldName)) { - schemas.chars = reader.readArray(CharSchema::fromJson); - } else if ("dates".equals(fieldName)) { - schemas.dates = reader.readArray(DateSchema::fromJson); - } else if ("dateTimes".equals(fieldName)) { - schemas.dateTimes = reader.readArray(DateTimeSchema::fromJson); - } else if ("durations".equals(fieldName)) { - schemas.durations = reader.readArray(DurationSchema::fromJson); - } else if ("uuids".equals(fieldName)) { - schemas.uuids = reader.readArray(UuidSchema::fromJson); - } else if ("uris".equals(fieldName)) { - schemas.uris = reader.readArray(UriSchema::fromJson); - } else if ("credentials".equals(fieldName)) { - schemas.credentials = reader.readArray(CredentialSchema::fromJson); - } else if ("odataQueries".equals(fieldName)) { - schemas.odataQueries = reader.readArray(ODataQuerySchema::fromJson); - } else if ("choices".equals(fieldName)) { - schemas.choices = reader.readArray(ChoiceSchema::fromJson); - } else if ("sealedChoices".equals(fieldName)) { - schemas.sealedChoices = reader.readArray(SealedChoiceSchema::fromJson); - } else if ("flags".equals(fieldName)) { - schemas.flags = reader.readArray(FlagSchema::fromJson); - } else if ("constants".equals(fieldName)) { - schemas.constants = reader.readArray(ConstantSchema::fromJson); - } else if ("ands".equals(fieldName)) { - schemas.ands = reader.readArray(AndSchema::fromJson); - } else if ("ors".equals(fieldName)) { - schemas.ors = reader.readArray(OrSchema::fromJson); - } else if ("xors".equals(fieldName)) { - schemas.xors = reader.readArray(XorSchema::fromJson); - } else if ("unknowns".equals(fieldName)) { - schemas.unknowns = reader.readArray(Schema::fromJson); - } else if ("parameterGroups".equals(fieldName)) { - schemas.parameterGroups = reader.readArray(ParameterGroupSchema::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Scheme.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Scheme.java deleted file mode 100644 index 09b9235481..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Scheme.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -/** - * Represents a security scheme. - */ -public class Scheme implements JsonSerializable { - private Scheme.SecuritySchemeType type; - // OAuth2 - private Set scopes = new HashSet<>(); - // Key - private String name; - private String in; - private String prefix; - - /** - * Creates a new instance of the Scheme class. - */ - public Scheme() { - } - - /** - * Gets the type of the security scheme. - * - * @return The type of the security scheme. - */ - public Scheme.SecuritySchemeType getType() { - return type; - } - - /** - * Sets the type of the security scheme. - * - * @param type The type of the security scheme. - */ - public void setType(Scheme.SecuritySchemeType type) { - this.type = type; - } - - /** - * Gets the scopes of the security scheme. - * - * @return The scopes of the security scheme. - */ - public Set getScopes() { - return scopes; - } - - /** - * Sets the scopes of the security scheme. - * - * @param scopes The scopes of the security scheme. - */ - public void setScopes(Set scopes) { - this.scopes = scopes; - } - - /** - * Gets the name of the security scheme. - * - * @return The name of the security scheme. - */ - public String getName() { - return name; - } - - /** - * Sets the name of the security scheme. - * - * @param name The name of the security scheme. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets the location of the security scheme. - * - * @return The location of the security scheme. - */ - public String getIn() { - return in; - } - - /** - * Sets the location of the security scheme. - * - * @param in The location of the security scheme. - */ - public void setIn(String in) { - this.in = in; - } - - /** - * Gets the prefix of the security scheme. - * - * @return The prefix of the security scheme. - */ - public String getPrefix() { - return prefix; - } - - /** - * Sets the prefix of the security scheme. - * - * @param prefix The prefix of the security scheme. - */ - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("type", type == null ? null : type.toString()) - .writeArrayField("scopes", scopes, JsonWriter::writeString) - .writeStringField("name", name) - .writeStringField("in", in) - .writeStringField("prefix", prefix) - .writeEndObject(); - } - - /** - * Deserializes a Scheme instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Scheme instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Scheme fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Scheme::new, (scheme, fieldName, reader) -> { - if ("type".equals(fieldName)) { - scheme.type = SecuritySchemeType.fromValue(reader.getString()); - } else if ("scopes".equals(fieldName)) { - List scopes = reader.readArray(JsonReader::getString); - scheme.scopes = scopes == null ? null : new HashSet<>(scopes); - } else if ("name".equals(fieldName)) { - scheme.name = reader.getString(); - } else if ("in".equals(fieldName)) { - scheme.in = reader.getString(); - } else if ("prefix".equals(fieldName)) { - scheme.prefix = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } - - /** - * The type of the security scheme. - */ - public enum SecuritySchemeType { - /** - * OAuth2 security scheme. - */ - OAUTH2("OAuth2"), - - /** - * Key security scheme. - */ - KEY("Key"); - - private final String value; - - SecuritySchemeType(String value) { - this.value = value; - } - - @Override - public String toString() { - return this.value; - } - - /** - * Get the value of the security scheme type. - * - * @return The value of the security scheme type. - */ - public String value() { - return this.value; - } - - /** - * Get the security scheme type from the value. - * - * @param value The value of the security scheme type. - * @return The security scheme type. - * @throws IllegalArgumentException thrown if the value does not match any of the security scheme types. - */ - public static Scheme.SecuritySchemeType fromValue(String value) { - if ("OAuth2".equals(value)) { - return OAUTH2; - } else if ("Key".equals(value)) { - return KEY; - } else { - throw new IllegalArgumentException(value); - } - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SealedChoiceSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SealedChoiceSchema.java deleted file mode 100644 index a119274f9a..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SealedChoiceSchema.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a choice of several values (ie, an 'enum'). - */ -public class SealedChoiceSchema extends ChoiceSchema { - - /** - * Creates a new instance of the SealedChoiceSchema class. - */ - public SealedChoiceSchema() { - super(); - } - - @Override - public String toString() { - return sharedToString(this, SealedChoiceSchema.class.getName()); - } - - @Override - public int hashCode() { - return sharedHashCode(this); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - if (!(other instanceof SealedChoiceSchema)) { - return false; - } - - return sharedEquals(this, (SealedChoiceSchema) other); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a SealedChoiceSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A SealedChoiceSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static SealedChoiceSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, SealedChoiceSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Security.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Security.java deleted file mode 100644 index 2205f74f33..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Security.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents security information. - */ -public class Security implements JsonSerializable { - private boolean authenticationRequired; - private List schemes = new ArrayList<>(); - - /** - * Creates a new instance of the Security class. - */ - public Security() { - } - - /** - * Gets whether authentication is required. - * - * @return Whether authentication is required. - */ - public boolean isAuthenticationRequired() { - return authenticationRequired; - } - - /** - * Sets whether authentication is required. - * - * @param authenticationRequired Whether authentication is required. - */ - public void setAuthenticationRequired(boolean authenticationRequired) { - this.authenticationRequired = authenticationRequired; - } - - /** - * Gets the security schemes. - * - * @return The security schemes. - */ - public List getSchemes() { - return schemes; - } - - /** - * Sets the security schemes. - * - * @param schemes The security schemes. - */ - public void setSchemes(List schemes) { - this.schemes = schemes; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeBooleanField("authenticationRequired", authenticationRequired) - .writeArrayField("schemes", schemes, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Security instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Security instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Security fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Security::new, (security, fieldName, reader) -> { - if ("authenticationRequired".equals(fieldName)) { - security.authenticationRequired = reader.getBoolean(); - } else if ("schemes".equals(fieldName)) { - security.schemes = reader.readArray(Scheme::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationFormat.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationFormat.java deleted file mode 100644 index 6402384912..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationFormat.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a serialization format. - */ -public class SerializationFormat implements JsonSerializable { - private DictionaryAny extensions; - - /** - * Creates a new instance of the SerializationFormat class. - */ - public SerializationFormat() { - } - - /** - * Gets the extensions. - * - * @return The extensions. - */ - public DictionaryAny getExtensions() { - return extensions; - } - - /** - * Sets the extensions. - * - * @param extensions The extensions. - */ - public void setExtensions(DictionaryAny extensions) { - this.extensions = extensions; - } - - @Override - public String toString() { - return SerializationFormat.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) - + "[extensions=" + Objects.toString(extensions, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hashCode(extensions); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof SerializationFormat)) { - return false; - } - - SerializationFormat rhs = ((SerializationFormat) other); - return Objects.equals(extensions, rhs.extensions); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("extensions", extensions) - .writeEndObject(); - } - - /** - * Deserializes a SerializationFormat instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A SerializationFormat instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static SerializationFormat fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, SerializationFormat::new, (format, fieldName, reader) -> { - if ("extensions".equals(fieldName)) { - format.extensions = DictionaryAny.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationFormats.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationFormats.java deleted file mode 100644 index e479dd7e36..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationFormats.java +++ /dev/null @@ -1,137 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents individual serialization formats. - */ -public class SerializationFormats implements JsonSerializable { - private SerializationFormat json; - private XmlSerializationFormat xml; - private SerializationFormat protobuf; - - /** - * Creates a new instance of the SerializationFormats class. - */ - public SerializationFormats() { - } - - /** - * Gets the JSON serialization format. - * - * @return The JSON serialization format. - */ - public SerializationFormat getJson() { - return json; - } - - /** - * Sets the JSON serialization format. - * - * @param json The JSON serialization format. - */ - public void setJson(SerializationFormat json) { - this.json = json; - } - - /** - * Gets the XML serialization format. - * - * @return The XML serialization format. - */ - public XmlSerializationFormat getXml() { - return xml; - } - - /** - * Sets the XML serialization format. - * - * @param xml The XML serialization format. - */ - public void setXml(XmlSerializationFormat xml) { - this.xml = xml; - } - - /** - * Gets the Protobuf serialization format. - * - * @return The Protobuf serialization format. - */ - public SerializationFormat getProtobuf() { - return protobuf; - } - - /** - * Sets the Protobuf serialization format. - * - * @param protobuf The Protobuf serialization format. - */ - public void setProtobuf(SerializationFormat protobuf) { - this.protobuf = protobuf; - } - - @Override - public String toString() { - return SerializationFormats.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) - + "[json=" + Objects.toString(json, "") + ",xml=" + Objects.toString(xml, "") + ",protobuf=" - + Objects.toString(protobuf, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(json, protobuf, xml); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof SerializationFormats)) { - return false; - } - - SerializationFormats rhs = ((SerializationFormats) other); - return Objects.equals(json, rhs.json) && Objects.equals(protobuf, rhs.protobuf) && Objects.equals(xml, rhs.xml); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("json", json) - .writeJsonField("xml", xml) - .writeJsonField("protobuf", protobuf) - .writeEndObject(); - } - - /** - * Deserializes a SerializationFormats instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A SerializationFormats instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static SerializationFormats fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, SerializationFormats::new, (formats, fieldName, reader) -> { - if ("json".equals(fieldName)) { - formats.json = SerializationFormat.fromJson(reader); - } else if ("xml".equals(fieldName)) { - formats.xml = XmlSerializationFormat.fromJson(reader); - } else if ("protobuf".equals(fieldName)) { - formats.protobuf = SerializationFormat.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationStyle.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationStyle.java deleted file mode 100644 index ab36e058f9..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/SerializationStyle.java +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import java.util.HashMap; -import java.util.Map; - -/** - * Represents individual serialization styles. - */ -public enum SerializationStyle { - /** - * The serialization style is binary. - */ - BINARY("binary"), - - /** - * The serialization style is deep object. - */ - DEEP_OBJECT("deepObject"), - - /** - * The serialization style is form. - */ - FORM("form"), - - /** - * The serialization style is JSON. - */ - JSON("json"), - - /** - * The serialization style is label. - */ - LABEL("label"), - - /** - * The serialization style is matrix. - */ - MATRIX("matrix"), - - /** - * The serialization style is pipe delimited. - */ - PIPE_DELIMITED("pipeDelimited"), - - /** - * The serialization style is simple. - */ - SIMPLE("simple"), - - /** - * The serialization style is space delimited. - */ - SPACE_DELIMITED("spaceDelimited"), - - /** - * The serialization style is tab delimited. - */ - TAB_DELIMITED("tabDelimited"), - - /** - * The serialization style is XML. - */ - XML("xml"); - - private final String value; - private final static Map CONSTANTS = new HashMap<>(); - - static { - for (SerializationStyle c : values()) { - CONSTANTS.put(c.value, c); - } - } - - SerializationStyle(String value) { - this.value = value; - } - - @Override - public String toString() { - if ("uri".equals(this.value)) { - return "host"; - } else { - return this.value; - } - } - - /** - * Gets the value of the serialization style. - * - * @return The value of the serialization style. - */ - public String value() { - return this.value; - } - - /** - * Gets the serialization style from its value. - * - * @param value The value of the serialization style. - * @return The serialization style. - * @throws IllegalArgumentException If the value is not a valid serialization style. - */ - public static SerializationStyle fromValue(String value) { - SerializationStyle constant = CONSTANTS.get(value); - if (constant == null) { - throw new IllegalArgumentException(value); - } else { - return constant; - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Server.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Server.java deleted file mode 100644 index 422706fddf..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Server.java +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents a server. - */ -public class Server implements JsonSerializable { - private String url; - private Languages language; - private List variables; - - /** - * Creates a new instance of the Server class. - */ - public Server() { - } - - /** - * Gets the URL of the server. - * - * @return The URL of the server. - */ - public String getUrl() { - return url; - } - - /** - * Sets the URL of the server. - * - * @param url The URL of the server. - */ - public void setUrl(String url) { - this.url = url; - } - - /** - * Gets the language-specific information for the server. - * - * @return The language-specific information for the server. - */ - public Languages getLanguage() { - return language; - } - - /** - * Sets the language-specific information for the server. - * - * @param language The language-specific information for the server. - */ - public void setLanguage(Languages language) { - this.language = language; - } - - /** - * Gets the variables for the server. - * - * @return The variables for the server. - */ - public List getVariables() { - return variables; - } - - /** - * Sets the variables for the server. - * - * @param variables The variables for the server. - */ - public void setVariables(List variables) { - this.variables = variables; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("url", url) - .writeJsonField("language", language) - .writeArrayField("variables", variables, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a Server instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Server instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Server fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Server::new, (server, fieldName, reader) -> { - if ("url".equals(fieldName)) { - server.url = reader.getString(); - } else if ("language".equals(fieldName)) { - server.language = Languages.fromJson(reader); - } else if ("variables".equals(fieldName)) { - server.variables = reader.readArray(Value::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ServiceVersion.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ServiceVersion.java deleted file mode 100644 index d5851c29f4..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ServiceVersion.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a service version. - */ -public class ServiceVersion extends Metadata { - /** - * Creates a new instance of the ServiceVersion class. - */ - public ServiceVersion() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a ServiceVersion instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ServiceVersion instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ServiceVersion fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ServiceVersion::new, (serviceVersion, fieldName, reader) -> { - if (!serviceVersion.tryConsumeParentProperties(serviceVersion, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/StreamResponse.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/StreamResponse.java deleted file mode 100644 index 2cdbcc6bf9..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/StreamResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a stream response. - */ -public class StreamResponse extends Response { - /** - * Creates a new instance of the StreamResponse class. - */ - public StreamResponse() { - super(); - } - - /** - * Whether the response is a stream. - * - * @return Whether the response is a stream. - */ - public boolean isStream() { - return true; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a StreamResponse instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A StreamResponse instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static StreamResponse fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, StreamResponse::new, (response, fieldName, reader) -> { - if (!response.tryConsumeParentProperties(response, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/StringSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/StringSchema.java deleted file mode 100644 index 0042e2e558..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/StringSchema.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a string value. - */ -public class StringSchema extends PrimitiveSchema { - private double maxLength; - private double minLength; - private String pattern; - - /** - * Creates a new instance of the StringSchema class. - */ - public StringSchema() { - super(); - } - - /** - * Gets the maximum length of the string. - * - * @return The maximum length of the string. - */ - public double getMaxLength() { - return maxLength; - } - - /** - * Sets the maximum length of the string. - * - * @param maxLength The maximum length of the string. - */ - public void setMaxLength(double maxLength) { - this.maxLength = maxLength; - } - - /** - * Gets the minimum length of the string. - * - * @return The minimum length of the string. - */ - public double getMinLength() { - return minLength; - } - - /** - * Sets the minimum length of the string. - * - * @param minLength The minimum length of the string. - */ - public void setMinLength(double minLength) { - this.minLength = minLength; - } - - /** - * Gets a regular expression that the string must be validated against. - * - * @return A regular expression that the string must be validated against. - */ - public String getPattern() { - return pattern; - } - - /** - * Sets a regular expression that the string must be validated against. - * - * @param pattern A regular expression that the string must be validated against. - */ - public void setPattern(String pattern) { - this.pattern = pattern; - } - - @Override - public String toString() { - return StringSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[maxLength=" - + maxLength + ",minLength=" + minLength + ",pattern=" + Objects.toString(pattern, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(pattern, maxLength, minLength); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof StringSchema)) { - return false; - } - - StringSchema rhs = ((StringSchema) other); - return maxLength == rhs.maxLength && minLength == rhs.minLength && Objects.equals(pattern, rhs.pattern); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeDoubleField("maxLength", maxLength) - .writeDoubleField("minLength", minLength) - .writeStringField("pattern", pattern) - .writeEndObject(); - } - - /** - * Deserializes a StringSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A StringSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static StringSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, StringSchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - if ("maxLength".equals(fieldName)) { - schema.maxLength = reader.getDouble(); - } else if ("minLength".equals(fieldName)) { - schema.minLength = reader.getDouble(); - } else if ("pattern".equals(fieldName)) { - schema.pattern = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestModel.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestModel.java deleted file mode 100644 index 3679ec2332..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestModel.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents a test model. - */ -public class TestModel implements JsonSerializable { - private List scenarioTests; - - /** - * Creates a new instance of the TestModel class. - */ - public TestModel() { - } - - /** - * Gets the API scenario definitions. - * - * @return The API scenario definitions. - */ - public List getScenarioTests() { - return scenarioTests; - } - - /** - * Sets the API scenario definitions. - * - * @param scenarioTests The API scenario definitions. - */ - public void setScenarioTests(List scenarioTests) { - this.scenarioTests = scenarioTests; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("scenarioTests", scenarioTests, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a TestModel instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A TestModel instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static TestModel fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, TestModel::new, (model, fieldName, reader) -> { - if ("scenarioTests".equals(fieldName)) { - model.scenarioTests = reader.readArray(ScenarioTest::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestScenario.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestScenario.java deleted file mode 100644 index f728f19ad0..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestScenario.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * Represents a test scenario. - */ -public class TestScenario implements JsonSerializable { - private String description; - private List requiredVariables; - private Map requiredVariablesDefault; - private String scenario; - private Boolean shareScope; - private List resolvedSteps; - - /** - * Creates a new instance of the TestScenario class. - */ - public TestScenario() { - } - - /** - * Gets the description of the scenario. - * - * @return The description of the scenario. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the scenario. - * - * @param description The description of the scenario. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the required variables for the scenario. - * - * @return The required variables for the scenario. - */ - public List getRequiredVariables() { - return requiredVariables; - } - - /** - * Sets the required variables for the scenario. - * - * @param requiredVariables The required variables for the scenario. - */ - public void setRequiredVariables(List requiredVariables) { - this.requiredVariables = requiredVariables; - } - - /** - * Gets the default values of the required variables. - * - * @return The default values of the required variables. - */ - public Map getRequiredVariablesDefault() { - return requiredVariablesDefault; - } - - /** - * Sets the default values of the required variables. - * - * @param requiredVariablesDefault The default values of the required variables. - */ - public void setRequiredVariablesDefault(Map requiredVariablesDefault) { - this.requiredVariablesDefault = requiredVariablesDefault; - } - - /** - * Gets the scenario. - * - * @return The scenario. - */ - public String getScenario() { - return scenario; - } - - /** - * Sets the scenario. - * - * @param scenario The scenario. - */ - public void setScenario(String scenario) { - this.scenario = scenario; - } - - /** - * Gets whether to share the scope and prepareSteps with other scenarios. - * - * @return Whether to share the scope and prepareSteps with other scenarios. - */ - public Boolean getShareScope() { - return shareScope; - } - - /** - * Sets whether to share the scope and prepareSteps with other scenarios. - * - * @param shareScope Whether to share the scope and prepareSteps with other scenarios. - */ - public void setShareScope(Boolean shareScope) { - this.shareScope = shareScope; - } - - /** - * Gets the resolved steps. - * - * @return The resolved steps. - */ - @YamlProperty("_resolvedSteps") - public List getResolvedSteps() { - return resolvedSteps; - } - - /** - * Sets the resolved steps. - * - * @param resolvedSteps The resolved steps. - */ - public void setResolvedSteps(List resolvedSteps) { - this.resolvedSteps = resolvedSteps; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("description", description) - .writeArrayField("requiredVariables", requiredVariables, JsonWriter::writeString) - .writeMapField("requiredVariablesDefault", requiredVariablesDefault, JsonWriter::writeString) - .writeStringField("scenario", scenario) - .writeBooleanField("shareScope", shareScope) - .writeArrayField("_resolvedSteps", resolvedSteps, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes a TestScenario instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A TestScenario instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static TestScenario fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, TestScenario::new, (scenario, fieldName, reader) -> { - if ("description".equals(fieldName)) { - scenario.description = reader.getString(); - } else if ("requiredVariables".equals(fieldName)) { - scenario.requiredVariables = reader.readArray(JsonReader::getString); - } else if ("requiredVariablesDefault".equals(fieldName)) { - scenario.requiredVariablesDefault = reader.readMap(JsonReader::getString); - } else if ("scenario".equals(fieldName)) { - scenario.scenario = reader.getString(); - } else if ("shareScope".equals(fieldName)) { - scenario.shareScope = reader.getNullable(JsonReader::getBoolean); - } else if ("_resolvedSteps".equals(fieldName)) { - scenario.resolvedSteps = reader.readArray(ScenarioStep::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestScenarioStepType.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestScenarioStepType.java deleted file mode 100644 index 3c066cce75..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TestScenarioStepType.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import java.util.HashMap; -import java.util.Map; - -/** - * Represents a test scenario step type. - */ -public enum TestScenarioStepType { - - /** - * Step to run a swagger operation defined rest call. This may not be just one http call. - *

- * If the operation is a long-running operation (LRO), then follow the LRO polling strategy. - * Response statusCode must be 200 if the LRO succeeded, no matter what code the initial response is. - * If the LRO is PUT/PATCH, the runner should automatically insert a GET after the polling to verify the resource - * update result. - * If the operation is DELETE, then after the operation, the runner should automatically insert a GET to verify - * resource cannot be found. - * Rest call step could be defined either by an example file, or by resourceName tracking and update. - */ - REST_CALL("restCall"), - /** - * Step to deploy ARM template to the scope. - */ - STEP_ARM_TEMPLATE("armTemplateDeployment"), - /** - * Step to deploy ARM deployment script to the scope. - */ - STEP_ARM_DEPLOYMENT_SCRIPT("stepArmDeploymentScript"); - - private final String value; - private static final Map CONSTANTS = new HashMap<>(); - - static { - for (TestScenarioStepType stepType : TestScenarioStepType.values()) { - CONSTANTS.put(stepType.value, stepType); - } - } - - TestScenarioStepType(String value) { - this.value = value; - } - - /** - * Gets the test scenario step type from its value. - * - * @param value The value of the test scenario step type. - * @return The test scenario step type. - * @throws IllegalArgumentException If the value is not a known test scenario step type. - */ - public static TestScenarioStepType fromValue(String value) { - TestScenarioStepType stepType = CONSTANTS.get(value); - if (stepType == null) { - throw new IllegalArgumentException(value); - } - return stepType; - } - -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TimeSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TimeSchema.java deleted file mode 100644 index 9878c12649..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/TimeSchema.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a time schema. - */ -public class TimeSchema extends PrimitiveSchema { - /** - * Creates a new instance of the TimeSchema class. - */ - public TimeSchema() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a TimeSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A TimeSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static TimeSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, TimeSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UnixTimeSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UnixTimeSchema.java deleted file mode 100644 index 941ce24e1b..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UnixTimeSchema.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a UnixTime value. - */ -public class UnixTimeSchema extends PrimitiveSchema { - - /** - * Creates a new instance of the UnixTimeSchema class. - */ - public UnixTimeSchema() { - super(); - } - - @Override - public String toString() { - return UnixTimeSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof UnixTimeSchema; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a UnixTimeSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A UnixTimeSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static UnixTimeSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, UnixTimeSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UriSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UriSchema.java deleted file mode 100644 index 94d6ea6df3..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UriSchema.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents a Uri value. - */ -public class UriSchema extends PrimitiveSchema { - private double maxLength; - private double minLength; - private String pattern; - - /** - * Creates a new instance of the UriSchema class. - */ - public UriSchema() { - super(); - } - - /** - * Get the maximum length of the URI. - * - * @return The maximum length of the URI. - */ - public double getMaxLength() { - return maxLength; - } - - /** - * Set the maximum length of the URI. - * - * @param maxLength The maximum length of the URI. - */ - public void setMaxLength(double maxLength) { - this.maxLength = maxLength; - } - - /** - * Get the minimum length of the URI. - * - * @return The minimum length of the URI. - */ - public double getMinLength() { - return minLength; - } - - /** - * Set the minimum length of the URI. - * - * @param minLength The minimum length of the URI. - */ - public void setMinLength(double minLength) { - this.minLength = minLength; - } - - /** - * Get a regular expression that the URI must be validated against. - * - * @return A regular expression that the URI must be validated against. - */ - public String getPattern() { - return pattern; - } - - /** - * Set a regular expression that the URI must be validated against. - * - * @param pattern A regular expression that the URI must be validated against. - */ - public void setPattern(String pattern) { - this.pattern = pattern; - } - - @Override - public String toString() { - return UriSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[maxLength=" - + maxLength + ",minLength=" + minLength + ",pattern=" + Objects.toString(pattern, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(pattern, maxLength, minLength); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof UriSchema)) { - return false; - } - - UriSchema rhs = ((UriSchema) other); - return maxLength == rhs.maxLength && minLength == rhs.minLength && Objects.equals(pattern, rhs.pattern); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeDoubleField("maxLength", maxLength) - .writeDoubleField("minLength", minLength) - .writeStringField("pattern", pattern) - .writeEndObject(); - } - - /** - * Deserializes a UriSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A UriSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static UriSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, UriSchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - - if ("maxLength".equals(fieldName)) { - schema.maxLength = reader.getDouble(); - } else if ("minLength".equals(fieldName)) { - schema.minLength = reader.getDouble(); - } else if ("pattern".equals(fieldName)) { - schema.pattern = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UuidSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UuidSchema.java deleted file mode 100644 index da045c52ae..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/UuidSchema.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents a Uuid value. - */ -public class UuidSchema extends PrimitiveSchema { - - /** - * Creates a new instance of the UuidSchema class. - */ - public UuidSchema() { - super(); - } - - @Override - public String toString() { - return UuidSchema.class.getName() + '@' + Integer.toHexString(System.identityHashCode(this)) + "[]"; - } - - @Override - public int hashCode() { - return 1; - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - return other instanceof UuidSchema; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a UuidSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A UuidSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static UuidSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, UuidSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Value.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Value.java deleted file mode 100644 index 60aa3d3a6e..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/Value.java +++ /dev/null @@ -1,296 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * Represents a value. - */ -public class Value extends Metadata { - private Schema schema; - private boolean required; - private boolean nullable; - private String $key; - private String description; - private String uid; - private String summary; - private List apiVersions = new ArrayList<>(); - private Deprecation deprecated; - private ExternalDocumentation externalDocs; - - /** - * Creates a new instance of the Value class. - */ - public Value() { - } - - /** - * Gets the summary of the value. - * - * @return The summary of the value. - */ - public String getSummary() { - return summary; - } - - /** - * Sets the summary of the value. - * - * @param summary The summary of the value. - */ - public void setSummary(String summary) { - this.summary = summary; - } - - /** - * Gets the unique identifier of the value. (Required) - * - * @return The unique identifier of the value. - */ - public String getUid() { - return uid; - } - - /** - * Sets the unique identifier of the value. (Required) - * - * @param uid The unique identifier of the value. - */ - public void setUid(String uid) { - this.uid = uid; - } - - /** - * Gets the key of the value. (Required) - * - * @return The key of the value. - */ - public String get$key() { - return $key; - } - - /** - * Sets the key of the value. (Required) - * - * @param $key The key of the value. - */ - public void set$key(String $key) { - this.$key = $key; - } - - /** - * Gets the description of the value. (Required) - * - * @return The description of the value. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the value. (Required) - * - * @param description The description of the value. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the API versions that this applies to. Undefined means all versions. - * - * @return The API versions that this applies to. Undefined means all versions. - */ - public List getApiVersions() { - return apiVersions; - } - - /** - * Sets the API versions that this applies to. Undefined means all versions. - * - * @param apiVersions The API versions that this applies to. Undefined means all versions. - */ - public void setApiVersions(List apiVersions) { - this.apiVersions = apiVersions; - } - - /** - * Gets the deprecation information for the value. - * - * @return The deprecation information for the value. - */ - public Deprecation getDeprecated() { - return deprecated; - } - - /** - * Sets the deprecation information for the value. - * - * @param deprecated The deprecation information for the value. - */ - public void setDeprecated(Deprecation deprecated) { - this.deprecated = deprecated; - } - - /** - * Gets a reference to external documentation. - * - * @return A reference to external documentation. - */ - public ExternalDocumentation getExternalDocs() { - return externalDocs; - } - - /** - * Sets a reference to external documentation. - * - * @param externalDocs A reference to external documentation. - */ - public void setExternalDocs(ExternalDocumentation externalDocs) { - this.externalDocs = externalDocs; - } - - /** - * Gets the schema of the value. (Required) - * - * @return The schema of the value. - */ - public Schema getSchema() { - return schema; - } - - /** - * Sets the schema of the value. (Required) - * - * @param schema The schema of the value. - */ - public void setSchema(Schema schema) { - // This should ideally be done by the modeler if the header collection prefix is set. - // The schema should be of type dictionary - // TODO: remove this when modeler is fixed. - if (this.getExtensions() != null && this.getExtensions().getXmsHeaderCollectionPrefix() != null - && schema instanceof StringSchema) { - DictionarySchema dictionarySchema = new DictionarySchema(); - dictionarySchema.setElementType(schema); - this.schema = dictionarySchema; - // return; - } - this.schema = schema; - } - - /** - * Gets whether the value is required. - * - * @return Whether the value is required. - */ - public boolean isRequired() { - return required; - } - - /** - * Sets whether the value is required. - * - * @param required Whether the value is required. - */ - public void setRequired(boolean required) { - this.required = required; - } - - /** - * Gets whether the value is nullable. - * - * @return Whether the value is nullable. - */ - public boolean isNullable() { - return nullable; - } - - /** - * Sets whether the value is nullable. - * - * @param nullable Whether the value is nullable. - */ - public void setNullable(boolean nullable) { - this.nullable = nullable; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return writeParentProperties(jsonWriter.writeStartObject()).writeEndObject(); - } - - JsonWriter writeParentProperties(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter) - .writeJsonField("schema", schema) - .writeBooleanField("required", required) - .writeBooleanField("nullable", nullable) - .writeStringField("$key", $key) - .writeStringField("description", description) - .writeStringField("uid", uid) - .writeStringField("summary", summary) - .writeArrayField("apiVersions", apiVersions, JsonWriter::writeJson) - .writeJsonField("deprecated", deprecated) - .writeJsonField("externalDocs", externalDocs); - } - - /** - * Deserializes a Value instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Value instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Value fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, Value::new, (value, fieldName, reader) -> { - if (!value.tryConsumeParentProperties(value, fieldName, reader)) { - reader.skipChildren(); - } - }); - } - - boolean tryConsumeParentProperties(Value value, String fieldName, JsonReader reader) throws IOException { - if (super.tryConsumeParentProperties(value, fieldName, reader)) { - return true; - } else if ("schema".equals(fieldName)) { - value.schema = Schema.fromJson(reader); - return true; - } else if ("required".equals(fieldName)) { - value.required = reader.getBoolean(); - return true; - } else if ("nullable".equals(fieldName)) { - value.nullable = reader.getBoolean(); - return true; - } else if ("$key".equals(fieldName)) { - value.$key = reader.getString(); - return true; - } else if ("description".equals(fieldName)) { - value.description = reader.getString(); - return true; - } else if ("uid".equals(fieldName)) { - value.uid = reader.getString(); - return true; - } else if ("summary".equals(fieldName)) { - value.summary = reader.getString(); - return true; - } else if ("apiVersions".equals(fieldName)) { - value.apiVersions = reader.readArray(ApiVersion::fromJson); - return true; - } else if ("deprecated".equals(fieldName)) { - value.deprecated = Deprecation.fromJson(reader); - return true; - } else if ("externalDocs".equals(fieldName)) { - value.externalDocs = ExternalDocumentation.fromJson(reader); - return true; - } - - return false; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ValueSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ValueSchema.java deleted file mode 100644 index 1d2483f5cc..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/ValueSchema.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Schema types that are non-object or complex types. - */ -public class ValueSchema extends Schema { - /** - * Creates a new instance of the ValueSchema class. - */ - public ValueSchema() { - super(); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.toJson(jsonWriter); - } - - /** - * Deserializes a ValueSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A ValueSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static ValueSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, ValueSchema::new, (schema, fieldName, reader) -> { - if (!schema.tryConsumeParentProperties(schema, fieldName, reader)) { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/XmlSerializationFormat.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/XmlSerializationFormat.java deleted file mode 100644 index c18dbb1f8f..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/XmlSerializationFormat.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Objects; - -/** - * Represents the XML serialization format. - */ -public class XmlSerializationFormat extends SerializationFormat { - private String name; - private String namespace; - private String prefix; - private boolean attribute; - private boolean wrapped; - private boolean text; - - /** - * Creates a new instance of the XmlSerializationFormat class. - */ - public XmlSerializationFormat() { - } - - /** - * Gets the name of the XML element. - * - * @return The name of the XML element. - */ - public String getName() { - return name; - } - - /** - * Sets the name of the XML element. - * - * @param name The name of the XML element. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets the namespace of the XML element. - * - * @return The namespace of the XML element. - */ - public String getNamespace() { - return namespace; - } - - /** - * Sets the namespace of the XML element. - * - * @param namespace The namespace of the XML element. - */ - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - /** - * Gets the prefix of the XML element. - * - * @return The prefix of the XML element. - */ - public String getPrefix() { - return prefix; - } - - /** - * Sets the prefix of the XML element. - * - * @param prefix The prefix of the XML element. - */ - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - /** - * Gets whether the XML element is an attribute. - * - * @return Whether the XML element is an attribute. - */ - public boolean isAttribute() { - return attribute; - } - - /** - * Sets whether the XML element is an attribute. - * - * @param attribute Whether the XML element is an attribute. - */ - public void setAttribute(boolean attribute) { - this.attribute = attribute; - } - - /** - * Gets whether the XML element is wrapped. - * - * @return Whether the XML element is wrapped. - */ - public boolean isWrapped() { - return wrapped; - } - - /** - * Sets whether the XML element is wrapped. - * - * @param wrapped Whether the XML element is wrapped. - */ - public void setWrapped(boolean wrapped) { - this.wrapped = wrapped; - } - - /** - * Gets whether the XML element is text. - * - * @return Whether the XML element is text. - */ - public boolean isText() { - return text; - } - - /** - * Sets whether the XML element is text. - * - * @param text Whether the XML element is text. - */ - public void setText(boolean text) { - this.text = text; - } - - @Override - public String toString() { - return XmlSerializationFormat.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) - + "[name=" + Objects.toString(name, "") + ",namespace=" + Objects.toString(namespace, "") - + ",prefix=" + Objects.toString(prefix, "") + ",attribute=" + attribute + ",wrapped=" + wrapped - + ",text=" + text + "]"; - } - - @Override - public int hashCode() { - return Objects.hash(name, namespace, attribute, wrapped, prefix, text); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof XmlSerializationFormat)) { - return false; - } - XmlSerializationFormat rhs = ((XmlSerializationFormat) other); - return Objects.equals(name, rhs.name) && Objects.equals(namespace, rhs.namespace) && attribute == rhs.attribute - && wrapped == rhs.wrapped && Objects.equals(prefix, rhs.prefix) && text == rhs.text; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("extensions", getExtensions()) - .writeStringField("name", name) - .writeStringField("namespace", namespace) - .writeStringField("prefix", prefix) - .writeBooleanField("attribute", attribute) - .writeBooleanField("wrapped", wrapped) - .writeBooleanField("text", text) - .writeEndObject(); - } - - /** - * Deserializes a XmlSerializationFormat instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A XmlSerializationFormat instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmlSerializationFormat fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, XmlSerializationFormat::new, (format, fieldName, reader) -> { - if ("extensions".equals(fieldName)) { - format.setExtensions(DictionaryAny.fromJson(reader)); - } else if ("name".equals(fieldName)) { - format.name = reader.getString(); - } else if ("namespace".equals(fieldName)) { - format.namespace = reader.getString(); - } else if ("prefix".equals(fieldName)) { - format.prefix = reader.getString(); - } else if ("attribute".equals(fieldName)) { - format.attribute = reader.getBoolean(); - } else if ("wrapped".equals(fieldName)) { - format.wrapped = reader.getBoolean(); - } else if ("text".equals(fieldName)) { - format.text = reader.getBoolean(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/XorSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/XorSchema.java deleted file mode 100644 index 8afa85064a..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/XorSchema.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * Represents an XOR relationship between several schemas - */ -public class XorSchema extends ComplexSchema { - private List oneOf = new ArrayList<>(); - - /** - * Creates a new instance of the XorSchema class. - */ - public XorSchema() { - super(); - } - - /** - * Gets the set of schemas that this must be one and only one of. (Required) - * - * @return The set of schemas that this must be one and only one of. - */ - public List getOneOf() { - return oneOf; - } - - /** - * Sets the set of schemas that this must be one and only one of. (Required) - * - * @param oneOf The set of schemas that this must be one and only one of. - */ - public void setOneOf(List oneOf) { - this.oneOf = oneOf; - } - - @Override - public String toString() { - return XorSchema.class.getName() + "@" + Integer.toHexString(System.identityHashCode(this)) + "[oneOf=" - + Objects.toString(oneOf, "") + "]"; - } - - @Override - public int hashCode() { - return Objects.hashCode(oneOf); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - if (!(other instanceof XorSchema)) { - return false; - } - - XorSchema rhs = ((XorSchema) other); - return Objects.equals(oneOf, rhs.oneOf); - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return super.writeParentProperties(jsonWriter.writeStartObject()) - .writeArrayField("oneOf", oneOf, JsonWriter::writeJson) - .writeEndObject(); - } - /** - * Deserializes a XorSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A XorSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XorSchema fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, XorSchema::new, (schema, fieldName, reader) -> { - if (schema.tryConsumeParentProperties(schema, fieldName, reader)) { - return; - } - - if ("oneOf".equals(fieldName)) { - schema.oneOf = reader.readArray(Schema::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/YamlProperty.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/YamlProperty.java deleted file mode 100644 index 37ae87a53b..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/YamlProperty.java +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.codemodel; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Customize a property mapping between a yaml property and a java property - * It's currently a hint to let specific yaml constructor to decide whether serialize or deserialize - * according to this annotation. - * - * @see AnnotatedPropertyUtils - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.METHOD) -public @interface YamlProperty { - - /** - * The property name to read from yaml. - * @return the property name to read from yaml - */ - String value(); -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/package-info.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/package-info.java deleted file mode 100644 index 540560a041..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/codemodel/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * Contains models for code models. - */ -package com.azure.typespec.extension.base.model.codemodel; diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/AllowedResource.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/AllowedResource.java deleted file mode 100644 index de2de476e3..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/AllowedResource.java +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents a resource that is allowed to be accessed. - */ -public class AllowedResource implements JsonSerializable { - private List scopes; - private String type; - - /** - * Creates a new instance of the AllowedResource class. - */ - public AllowedResource() { - } - - /** - * Gets the scopes that are allowed to access the resource. - * - * @return The scopes that are allowed to access the resource. - */ - public List getScopes() { - return scopes; - } - - /** - * Sets the scopes that are allowed to access the resource. - * - * @param scopes The scopes that are allowed to access the resource. - */ - public void setScopes(List scopes) { - this.scopes = scopes; - } - - /** - * Gets the type of the resource. - * - * @return The type of the resource. - */ - public String getType() { - return type; - } - - /** - * Sets the type of the resource. - * - * @param type The type of the resource. - */ - public void setType(String type) { - this.type = type; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("scopes", scopes, JsonWriter::writeString) - .writeStringField("type", type) - .writeEndObject(); - } - - /** - * Deserializes an AllowedResource instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An AllowedResource instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static AllowedResource fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, AllowedResource::new, (allowedResource, fieldName, reader) -> { - if ("scopes".equals(fieldName)) { - allowedResource.scopes = reader.readArray(JsonReader::getString); - } else if ("type".equals(fieldName)) { - allowedResource.type = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsArmIdDetails.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsArmIdDetails.java deleted file mode 100644 index 0a94a574b0..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsArmIdDetails.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents the details of an ARM ID. - */ -public class XmsArmIdDetails implements JsonSerializable { - private List allowedResources; - - /** - * Creates a new instance of the XmsArmIdDetails class. - */ - public XmsArmIdDetails() { - } - - /** - * Gets the resources that are allowed to be accessed. - * - * @return The resources that are allowed to be accessed. - */ - public List getAllowedResources() { - return allowedResources; - } - - /** - * Sets the resources that are allowed to be accessed. - * - * @param allowedResources The resources that are allowed to be accessed. - */ - public void setAllowedResources(List allowedResources) { - this.allowedResources = allowedResources; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeArrayField("allowedResources", allowedResources, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes an XmsArmIdDetails instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An XmsArmIdDetails instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmsArmIdDetails fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, XmsArmIdDetails::new, (xmsArmIdDetails, fieldName, reader) -> { - if ("allowedResources".equals(fieldName)) { - xmsArmIdDetails.allowedResources = reader.readArray(AllowedResource::fromJson); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsEnum.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsEnum.java deleted file mode 100644 index 8070fdb95d..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsEnum.java +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents an enum. - */ -public class XmsEnum implements JsonSerializable { - private String name; - private boolean modelAsString = false; - private List values; - - /** - * Creates a new instance of the XmsEnum class. - */ - public XmsEnum() { - } - - /** - * Gets the name of the enum. - * - * @return The name of the enum. - */ - public String getName() { - return name; - } - - /** - * Sets the name of the enum. - * - * @param name The name of the enum. - */ - public void setName(String name) { - this.name = name; - } - - /** - * Gets whether the enum is represented as a string. - * - * @return Whether the enum is represented as a string. - */ - public boolean isModelAsString() { - return modelAsString; - } - - /** - * Sets whether the enum is represented as a string. - * - * @param modelAsString Whether the enum is represented as a string. - */ - public void setModelAsString(boolean modelAsString) { - this.modelAsString = modelAsString; - } - - /** - * Gets the values of the enum. - * - * @return The values of the enum. - */ - public List getValues() { - return values; - } - - /** - * Sets the values of the enum. - * - * @param values The values of the enum. - */ - public void setValues(List values) { - this.values = values; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("name", name) - .writeBooleanField("modelAsString", modelAsString) - .writeArrayField("values", values, JsonWriter::writeJson) - .writeEndObject(); - } - - /** - * Deserializes an XmsEnum instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An XmsEnum instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmsEnum fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, XmsEnum::new, (xmsEnum, fieldName, reader) -> { - if ("name".equals(fieldName)) { - xmsEnum.name = reader.getString(); - } else if ("modelAsString".equals(fieldName)) { - xmsEnum.modelAsString = reader.getBoolean(); - } else if ("values".equals(fieldName)) { - xmsEnum.values = reader.readArray(Value::fromJson); - } else { - reader.skipChildren(); - } - }); - } - - /** - * Represents a value of the enum. - */ - public static class Value implements JsonSerializable { - private String value; - private String description; - private String name; - - /** - * Creates a new instance of the Value class. - */ - public Value() { - } - - /** - * Gets the value of the enum. - * - * @return The value of the enum. - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the enum. - * - * @param value The value of the enum. - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the description of the value. - * - * @return The description of the value. - */ - public String getDescription() { - return description; - } - - /** - * Sets the description of the value. - * - * @param description The description of the value. - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Gets the name of the value. - * - * @return The name of the value. - */ - public String getName() { - return name; - } - - /** - * Sets the name of the value. - * - * @param name The name of the value. - */ - public void setName(String name) { - this.name = name; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("value", value) - .writeStringField("description", description) - .writeStringField("name", name) - .writeEndObject(); - } - - /** - * Deserializes a Value instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A Value instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static Value fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, Value::new, (value, fieldName, reader) -> { - if ("value".equals(fieldName)) { - value.value = reader.getString(); - } else if ("description".equals(fieldName)) { - value.description = reader.getString(); - } else if ("name".equals(fieldName)) { - value.name = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsExamples.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsExamples.java deleted file mode 100644 index 256519674d..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsExamples.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.Map; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents the examples of a model. - */ -public class XmsExamples implements JsonSerializable { - private Map examples; - - /** - * Creates a new instance of the XmsExamples class. - */ - public XmsExamples() { - } - - /** - * Gets the examples of the model. - * - * @return The examples of the model. - */ - public Map getExamples() { - return examples; - } - - /** - * Sets the examples of the model. - * - * @param examples The examples of the model. - */ - public void setExamples(Map examples) { - this.examples = examples; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeMapField("examples", examples, JsonWriter::writeUntyped) - .writeEndObject(); - } - - /** - * Deserializes an XmsExamples instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An XmsExamples instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmsExamples fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, XmsExamples::new, (xmsExamples, fieldName, reader) -> { - if ("examples".equals(fieldName)) { - xmsExamples.examples = reader.readMap(JsonReader::readUntyped); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsExtensions.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsExtensions.java deleted file mode 100644 index 456ea2b0f2..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsExtensions.java +++ /dev/null @@ -1,397 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; -import java.util.List; - -/** - * Represents the x-ms-extensions of a model. - */ -public class XmsExtensions implements JsonSerializable { - private XmsEnum xmsEnum; - private String xmsClientName; - private XmsPageable xmsPageable; - private boolean xmsSkipUrlEncoding; - private boolean xmsClientFlatten; - private boolean xmsLongRunningOperation; - private XmsLongRunningOperationOptions xmsLongRunningOperationOptions; - private boolean xmsFlattened; - private boolean xmsAzureResource; - private List xmsMutability; - private String xmsHeaderCollectionPrefix; - private XmsInternalAutorestAnonymousSchema xmsInternalAutorestAnonymousSchema; - private XmsArmIdDetails xmsArmIdDetails; - private XmsExamples xmsExamples; - private Boolean xmsSecret; - private List xmsVersioningAdded; - - /** - * Creates a new instance of the XmsExtensions class. - */ - public XmsExtensions() { - } - - /** - * Gets the enum of the model. - * - * @return The enum of the model. - */ - public XmsEnum getXmsEnum() { - return xmsEnum; - } - - /** - * Sets the enum of the model. - * - * @param xmsEnum The enum of the model. - */ - public void setXmsEnum(XmsEnum xmsEnum) { - this.xmsEnum = xmsEnum; - } - - /** - * Gets the client name of the model. - * - * @return The client name of the model. - */ - public String getXmsClientName() { - return xmsClientName; - } - - /** - * Sets the client name of the model. - * - * @param xmsClientName The client name of the model. - */ - public void setXmsClientName(String xmsClientName) { - this.xmsClientName = xmsClientName; - } - - /** - * Gets the pageable of the model. - * - * @return The pageable of the model. - */ - public XmsPageable getXmsPageable() { - return xmsPageable; - } - - /** - * Sets the pageable of the model. - * - * @param xmsPageable The pageable of the model. - */ - public void setXmsPageable(XmsPageable xmsPageable) { - this.xmsPageable = xmsPageable; - } - - /** - * Gets the skip URL encoding of the model. - * - * @return The skip URL encoding of the model. - */ - public boolean isXmsSkipUrlEncoding() { - return xmsSkipUrlEncoding; - } - - /** - * Sets the skip URL encoding of the model. - * - * @param xmsSkipUrlEncoding The skip URL encoding of the model. - */ - public void setXmsSkipUrlEncoding(boolean xmsSkipUrlEncoding) { - this.xmsSkipUrlEncoding = xmsSkipUrlEncoding; - } - - /** - * Gets the client flatten of the model. - * - * @return The client flatten of the model. - */ - public boolean isXmsClientFlatten() { - return xmsClientFlatten; - } - - /** - * Sets the client flatten of the model. - * - * @param xmsClientFlatten The client flatten of the model. - */ - public void setXmsClientFlatten(boolean xmsClientFlatten) { - this.xmsClientFlatten = xmsClientFlatten; - } - - /** - * Gets the long-running operation of the model. - * - * @return The long-running operation of the model. - */ - public boolean isXmsLongRunningOperation() { - return xmsLongRunningOperation; - } - - /** - * Sets the long-running operation of the model. - * - * @param xmsLongRunningOperation The long-running operation of the model. - */ - public void setXmsLongRunningOperation(boolean xmsLongRunningOperation) { - this.xmsLongRunningOperation = xmsLongRunningOperation; - } - - /** - * Gets the flattened of the model. - * - * @return The flattened of the model. - */ - public boolean isXmsFlattened() { - return xmsFlattened; - } - - /** - * Sets the flattened of the model. - * - * @param xmsFlattened The flattened of the model. - */ - public void setXmsFlattened(boolean xmsFlattened) { - this.xmsFlattened = xmsFlattened; - } - - /** - * Gets the Azure resource of the model. - * - * @return The Azure resource of the model. - */ - public boolean isXmsAzureResource() { - return xmsAzureResource; - } - - /** - * Sets the Azure resource of the model. - * - * @param xmsAzureResource The Azure resource of the model. - */ - public void setXmsAzureResource(boolean xmsAzureResource) { - this.xmsAzureResource = xmsAzureResource; - } - - /** - * Gets the mutability of the model. - * - * @return The mutability of the model. - */ - public List getXmsMutability() { - return xmsMutability; - } - - /** - * Sets the mutability of the model. - * - * @param xmsMutability The mutability of the model. - */ - public void setXmsMutability(List xmsMutability) { - this.xmsMutability = xmsMutability; - } - - /** - * Gets the header collection prefix of the model. - * - * @return The header collection prefix of the model. - */ - public String getXmsHeaderCollectionPrefix() { - return xmsHeaderCollectionPrefix; - } - - /** - * Sets the header collection prefix of the model. - * - * @param xmsHeaderCollectionPrefix The header collection prefix of the model. - */ - public void setXmsHeaderCollectionPrefix(String xmsHeaderCollectionPrefix) { - this.xmsHeaderCollectionPrefix = xmsHeaderCollectionPrefix; - } - - /** - * Gets the internal autorest anonymous schema of the model. - * - * @return The internal autorest anonymous schema of the model. - */ - public XmsInternalAutorestAnonymousSchema getXmsInternalAutorestAnonymousSchema() { - return xmsInternalAutorestAnonymousSchema; - } - - /** - * Sets the internal autorest anonymous schema of the model. - * - * @param xmsInternalAutorestAnonymousSchema The internal autorest anonymous schema of the model. - */ - public void setXmsInternalAutorestAnonymousSchema(XmsInternalAutorestAnonymousSchema xmsInternalAutorestAnonymousSchema) { - this.xmsInternalAutorestAnonymousSchema = xmsInternalAutorestAnonymousSchema; - } - - /** - * Gets the long-running operation options of the model. - * - * @return The long-running operation options of the model. - */ - public XmsLongRunningOperationOptions getXmsLongRunningOperationOptions() { - return xmsLongRunningOperationOptions; - } - - /** - * Sets the long-running operation options of the model. - * - * @param xmsLongRunningOperationOptions The long-running operation options of the model. - */ - public void setXmsLongRunningOperationOptions(XmsLongRunningOperationOptions xmsLongRunningOperationOptions) { - this.xmsLongRunningOperationOptions = xmsLongRunningOperationOptions; - } - - /** - * Gets the ARM ID details of the model. - * - * @return The ARM ID details of the model. - */ - public XmsArmIdDetails getXmsArmIdDetails() { - return xmsArmIdDetails; - } - - /** - * Sets the ARM ID details of the model. - * - * @param xmsArmIdDetails The ARM ID details of the model. - */ - public void setXmsArmIdDetails(XmsArmIdDetails xmsArmIdDetails) { - this.xmsArmIdDetails = xmsArmIdDetails; - } - - /** - * Gets the examples of the model. - * - * @return The examples of the model. - */ - public XmsExamples getXmsExamples() { - return xmsExamples; - } - - /** - * Sets the examples of the model. - * - * @param xmsExamples The examples of the model. - */ - public void setXmsExamples(XmsExamples xmsExamples) { - this.xmsExamples = xmsExamples; - } - - /** - * Gets the secret of the model. - * - * @return The secret of the model. - */ - public Boolean getXmsSecret() { - return xmsSecret; - } - - /** - * Sets the secret of the model. - * - * @param xmsSecret The secret of the model. - */ - public void setXmsSecret(Boolean xmsSecret) { - this.xmsSecret = xmsSecret; - } - - /** - * Gets the versioning added of the model. - * - * @return The versioning added of the model. - */ - public List getXmsVersioningAdded() { - return xmsVersioningAdded; - } - - /** - * Sets the versioning added of the model. - * - * @param xmsVersioningAdded The versioning added of the model. - */ - public void setXmsVersioningAdded(List xmsVersioningAdded) { - this.xmsVersioningAdded = xmsVersioningAdded; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeJsonField("xmsEnum", xmsEnum) - .writeStringField("xmsClientName", xmsClientName) - .writeJsonField("xmsPageable", xmsPageable) - .writeBooleanField("xmsSkipUrlEncoding", xmsSkipUrlEncoding) - .writeBooleanField("xmsClientFlatten", xmsClientFlatten) - .writeBooleanField("xmsLongRunningOperation", xmsLongRunningOperation) - .writeJsonField("xmsLongRunningOperationOptions", xmsLongRunningOperationOptions) - .writeBooleanField("xmsFlattened", xmsFlattened) - .writeBooleanField("xmsAzureResource", xmsAzureResource) - .writeArrayField("xmsMutability", xmsMutability, JsonWriter::writeString) - .writeStringField("xmsHeaderCollectionPrefix", xmsHeaderCollectionPrefix) - .writeJsonField("xmsInternalAutorestAnonymousSchema", xmsInternalAutorestAnonymousSchema) - .writeJsonField("xmsArmIdDetails", xmsArmIdDetails) - .writeJsonField("xmsExamples", xmsExamples) - .writeBooleanField("xmsSecret", xmsSecret) - .writeArrayField("xmsVersioningAdded", xmsVersioningAdded, JsonWriter::writeString) - .writeEndObject(); - } - - /** - * Deserializes an XmsExtensions instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An XmsExtensions instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmsExtensions fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, XmsExtensions::new, (extensions, fieldName, reader) -> { - if ("xmsEnum".equals(fieldName)) { - extensions.xmsEnum = XmsEnum.fromJson(reader); - } else if ("xmsClientName".equals(fieldName)) { - extensions.xmsClientName = reader.getString(); - } else if ("xmsPageable".equals(fieldName)) { - extensions.xmsPageable = XmsPageable.fromJson(reader); - } else if ("xmsSkipUrlEncoding".equals(fieldName)) { - extensions.xmsSkipUrlEncoding = reader.getBoolean(); - } else if ("xmsClientFlatten".equals(fieldName)) { - extensions.xmsClientFlatten = reader.getBoolean(); - } else if ("xmsLongRunningOperation".equals(fieldName)) { - extensions.xmsLongRunningOperation = reader.getBoolean(); - } else if ("xmsLongRunningOperationOptions".equals(fieldName)) { - extensions.xmsLongRunningOperationOptions = XmsLongRunningOperationOptions.fromJson(reader); - } else if ("xmsFlattened".equals(fieldName)) { - extensions.xmsFlattened = reader.getBoolean(); - } else if ("xmsAzureResource".equals(fieldName)) { - extensions.xmsAzureResource = reader.getBoolean(); - } else if ("xmsMutability".equals(fieldName)) { - extensions.xmsMutability = reader.readArray(JsonReader::getString); - } else if ("xmsHeaderCollectionPrefix".equals(fieldName)) { - extensions.xmsHeaderCollectionPrefix = reader.getString(); - } else if ("xmsInternalAutorestAnonymousSchema".equals(fieldName)) { - extensions.xmsInternalAutorestAnonymousSchema = XmsInternalAutorestAnonymousSchema.fromJson(reader); - } else if ("xmsArmIdDetails".equals(fieldName)) { - extensions.xmsArmIdDetails = XmsArmIdDetails.fromJson(reader); - } else if ("xmsExamples".equals(fieldName)) { - extensions.xmsExamples = XmsExamples.fromJson(reader); - } else if ("xmsSecret".equals(fieldName)) { - extensions.xmsSecret = reader.getNullable(JsonReader::getBoolean); - } else if ("xmsVersioningAdded".equals(fieldName)) { - extensions.xmsVersioningAdded = reader.readArray(JsonReader::getString); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsInternalAutorestAnonymousSchema.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsInternalAutorestAnonymousSchema.java deleted file mode 100644 index 998ff939ae..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsInternalAutorestAnonymousSchema.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents an anonymous schema. - */ -public class XmsInternalAutorestAnonymousSchema implements JsonSerializable { - private boolean anonymous = true; - - /** - * Creates a new instance of the XmsInternalAutorestAnonymousSchema class. - */ - public XmsInternalAutorestAnonymousSchema() { - } - - /** - * Gets whether the schema is anonymous. - * - * @return Whether the schema is anonymous. - */ - public boolean isAnonymous() { - return anonymous; - } - - /** - * Sets whether the schema is anonymous. - * - * @param anonymous Whether the schema is anonymous. - */ - public void setAnonymous(boolean anonymous) { - this.anonymous = anonymous; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeBooleanField("anonymous", anonymous) - .writeEndObject(); - } - - /** - * Deserializes an XmsInternalAutorestAnonymousSchema instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An XmsInternalAutorestAnonymousSchema instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmsInternalAutorestAnonymousSchema fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, XmsInternalAutorestAnonymousSchema::new, (anonymousSchema, fieldName, reader) -> { - if ("anonymous".equals(fieldName)) { - anonymousSchema.anonymous = reader.getBoolean(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsLongRunningOperationOptions.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsLongRunningOperationOptions.java deleted file mode 100644 index 080072003d..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsLongRunningOperationOptions.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -import static com.azure.typespec.extension.base.util.JsonUtils.readObject; - -/** - * Represents the options for a long-running operation. - */ -public class XmsLongRunningOperationOptions implements JsonSerializable { - // azure-async-operation - // location - // original-uri - private String finalStateVia; - - /** - * Creates a new instance of the XmsLongRunningOperationOptions class. - */ - public XmsLongRunningOperationOptions() { - } - - /** - * Gets the final state via. - * - * @return The final state via. - */ - public String getFinalStateVia() { - return finalStateVia; - } - - /** - * Sets the final state via. - * - * @param finalStateVia The final state via. - */ - public void setFinalStateVia(String finalStateVia) { - this.finalStateVia = finalStateVia; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("finalStateVia", finalStateVia) - .writeEndObject(); - } - - /** - * Deserializes an XmsLongRunningOperationOptions instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An XmsLongRunningOperationOptions instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmsLongRunningOperationOptions fromJson(JsonReader jsonReader) throws IOException { - return readObject(jsonReader, XmsLongRunningOperationOptions::new, (lroOptions, fieldName, reader) -> { - if ("finalStateVia".equals(fieldName)) { - lroOptions.finalStateVia = reader.getString(); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsPageable.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsPageable.java deleted file mode 100644 index 2c64d20c79..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/XmsPageable.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.model.extensionmodel; - -import com.azure.typespec.extension.base.model.codemodel.Operation; -import com.azure.typespec.extension.base.util.JsonUtils; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonWriter; - -import java.io.IOException; - -/** - * Represents the pageable settings of a model. - */ -public class XmsPageable implements JsonSerializable { - private String itemName = "value"; - private String nextLinkName; - private String operationName; - private Operation nextOperation; - - /** - * Creates a new instance of the XmsPageable class. - */ - public XmsPageable() { - } - - /** - * Gets the name of the item in the pageable response. - * - * @return The name of the item in the pageable response. - */ - public String getItemName() { - return itemName; - } - - /** - * Sets the name of the item in the pageable response. - * - * @param itemName The name of the item in the pageable response. - */ - public void setItemName(String itemName) { - this.itemName = itemName; - } - - /** - * Gets the name of the next link in the pageable response. - * - * @return The name of the next link in the pageable response. - */ - public String getNextLinkName() { - return nextLinkName; - } - - /** - * Sets the name of the next link in the pageable response. - * - * @param nextLinkName The name of the next link in the pageable response. - */ - public void setNextLinkName(String nextLinkName) { - this.nextLinkName = nextLinkName; - } - - /** - * Gets the name of the operation that retrieves the next page of items. - * - * @return The name of the operation that retrieves the next page of items. - */ - public String getOperationName() { - return operationName; - } - - /** - * Sets the name of the operation that retrieves the next page of items. - * - * @param operationName The name of the operation that retrieves the next page of items. - */ - public void setOperationName(String operationName) { - this.operationName = operationName; - } - - /** - * Gets the operation that retrieves the next page of items. - * - * @return The operation that retrieves the next page of items. - */ - public Operation getNextOperation() { - return nextOperation; - } - - /** - * Sets the operation that retrieves the next page of items. - * - * @param nextOperation The operation that retrieves the next page of items. - */ - public void setNextOperation(Operation nextOperation) { - this.nextOperation = nextOperation; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("itemName", itemName) - .writeStringField("nextLinkName", nextLinkName) - .writeStringField("operationName", operationName) - .writeJsonField("nextOperation", nextOperation) - .writeEndObject(); - } - - /** - * Deserializes an XmsPageable instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return An XmsPageable instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static XmsPageable fromJson(JsonReader jsonReader) throws IOException { - return JsonUtils.readObject(jsonReader, XmsPageable::new, (pageable, fieldName, reader) -> { - if ("itemName".equals(fieldName)) { - pageable.itemName = reader.getString(); - } else if ("nextLinkName".equals(fieldName)) { - pageable.nextLinkName = reader.getString(); - } else if ("operationName".equals(fieldName)) { - pageable.operationName = reader.getString(); - } else if ("nextOperation".equals(fieldName)) { - pageable.nextOperation = Operation.fromJson(reader); - } else { - reader.skipChildren(); - } - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/package-info.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/package-info.java deleted file mode 100644 index bf1371656e..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/extensionmodel/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * Contains models for Swagger code model extensions. - */ -package com.azure.typespec.extension.base.model.extensionmodel; diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/package-info.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/package-info.java deleted file mode 100644 index 7024de5c65..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/model/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * Contains base models for extension base. - */ -package com.azure.typespec.extension.base.model; diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/AutorestSettings.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/AutorestSettings.java deleted file mode 100644 index 664bd0e1c5..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/AutorestSettings.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.plugin; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * The settings for the AutoRest extension. - */ -public class AutorestSettings { - private String title; - private String tag; - private String baseFolder; - private String outputFolder; - private List security = new ArrayList<>(); - private List securityScopes = new ArrayList<>(); - private String securityHeaderName; - private String javaSdksFolder; - private final List inputFiles = new ArrayList<>(); - private final List require = new ArrayList<>(); - - /** - * Creates a new instance of the AutorestSettings class. - */ - public AutorestSettings() { - } - - /** - * Gets the title of what Autorest is generation. - * - * @return The title of what Autorest is generating. - */ - public String getTitle() { - return this.title; - } - - /** - * Set the title of what Autorest is generating. - * - * @param title The title of what Autorest is generating. - */ - public void setTitle(String title) { - this.title = title; - } - - /** - * Gets the tag for what Autorest is generating. - * - * @return The tag for what Autorest is generating. - */ - public String getTag() { - return tag; - } - - /** - * Sets the tag for what Autorest is generating. - * - * @param tag The tag for what Autorest is generating. - */ - public void setTag(String tag) { - this.tag = tag; - } - - /** - * Gets the base folder for the generation. - * - * @return The base folder for the generation. - */ - public String getBaseFolder() { - return baseFolder; - } - - /** - * Sets the base folder for the generation. - * - * @param baseFolder The base folder for the generation. - */ - public void setBaseFolder(String baseFolder) { - this.baseFolder = baseFolder; - } - - /** - * Gets the output folder for the generation. - * - * @return The output folder for the generation. - */ - public String getOutputFolder() { - return outputFolder; - } - - /** - * Sets the output folder for the generation. - * - * @param outputFolder The output folder for the generation. - */ - public void setOutputFolder(String outputFolder) { - this.outputFolder = outputFolder; - } - - /** - * Gets the security settings for the generation. - * - * @return The security settings for the generation. - */ - public List getSecurity() { - return this.security; - } - - /** - * Sets the security settings for the generation. - * - * @param security The security settings for the generation. - * @throws NullPointerException If {@code security} is null. - */ - public void setSecurity(List security) { - this.security = Objects.requireNonNull(security); - } - - /** - * Gets the security scopes for the generation. - * - * @return The security scopes for the generation. - */ - public List getSecurityScopes() { - return this.securityScopes; - } - - /** - * Sets the security scopes for the generation. - * - * @param securityScopes The security scopes for the generation. - * @throws NullPointerException If {@code securityScopes} is null. - */ - public void setSecurityScopes(List securityScopes) { - this.securityScopes = Objects.requireNonNull(securityScopes); - } - - /** - * Gets the security header name for the generation. - * - * @return The security header name for the generation. - */ - public String getSecurityHeaderName() { - return this.securityHeaderName; - } - - /** - * Sets the security header name for the generation. - * - * @param securityHeaderName The security header name for the generation. - */ - public void setSecurityHeaderName(String securityHeaderName) { - this.securityHeaderName = securityHeaderName; - } - - /** - * Gets the folder containing the Java SDKs for the generation. - * - * @return The folder containing the Java SDKs for the generation. - */ - public String getJavaSdksFolder() { - return javaSdksFolder; - } - - /** - * Sets the folder containing the Java SDKs for the generation. - * - * @param javaSdksFolder The folder containing the Java SDKs for the generation. - */ - public void setJavaSdksFolder(String javaSdksFolder) { - this.javaSdksFolder = javaSdksFolder; - } - - /** - * Gets the input files for the generation. - * - * @return The input files for the generation. - */ - public List getInputFiles() { - return inputFiles; - } - - /** - * Gets the required plugins for the generation. - * - * @return The required plugins for the generation. - */ - public List getRequire() { - return require; - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/JavaSettings.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/JavaSettings.java deleted file mode 100644 index 25ddd257f8..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/JavaSettings.java +++ /dev/null @@ -1,1773 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.plugin; - -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import org.slf4j.Logger; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.function.Consumer; -import java.util.stream.Collectors; - -/** - * Settings that are used by the Java AutoRest Generator. - */ -public class JavaSettings { - private static final String VERSION = "4.0.0"; - private static JavaSettings instance; - private static NewPlugin host; - private static String header; - private static final Map SIMPLE_JAVA_SETTINGS = new HashMap<>(); - private static Logger logger; - private final boolean useKeyCredential; - private final String flavor; - private final boolean noCustomHeaders; - private final boolean disableTypedHeadersMethods; - - static void setHeader(String value) { - if ("MICROSOFT_MIT".equals(value)) { - header = MICROSOFT_MIT_LICENSE_HEADER + "\n" + String.format(DEFAULT_CODE_GENERATION_HEADER, VERSION); - } else if ("MICROSOFT_APACHE".equals(value)) { - header = MICROSOFT_APACHE_LICENSE_HEADER + "\n" + String.format(DEFAULT_CODE_GENERATION_HEADER, VERSION); - } else if ("MICROSOFT_MIT_NO_VERSION".equals(value)) { - header = MICROSOFT_MIT_LICENSE_HEADER + "\n" + DEFAULT_CODE_GENERATION_HEADER_WITHOUT_VERSION; - } else if ("MICROSOFT_MIT_SMALL_NO_VERSION".equals(value)) { - header = MICROSOFT_MIT_SMALL_LICENSE_HEADER + "\n" + DEFAULT_CODE_GENERATION_HEADER_WITHOUT_VERSION; - } else if ("MICROSOFT_APACHE_NO_VERSION".equals(value)) { - header = MICROSOFT_APACHE_LICENSE_HEADER + "\n" + DEFAULT_CODE_GENERATION_HEADER_WITHOUT_VERSION; - } else if ("MICROSOFT_MIT_NO_CODEGEN".equals(value)) { - header = MICROSOFT_MIT_LICENSE_HEADER + "\n" + "Code generated by Microsoft (R) AutoRest Code Generator."; - } else if ("NONE".equals(value)) { - header = ""; - } else if ("MICROSOFT_MIT_SMALL".equals(value)) { - header = MICROSOFT_MIT_SMALL_LICENSE_HEADER + "Code generated by Microsoft (R) AutoRest Code Generator."; - } else if ("MICROSOFT_MIT_SMALL_TYPESPEC".equals(value)) { - header = MICROSOFT_MIT_SMALL_LICENSE_HEADER + "Code generated by Microsoft (R) TypeSpec Code Generator."; - } else if ("SMALL_TYPESPEC".equals(value)) { - header = "Code generated by Microsoft (R) TypeSpec Code Generator."; - } else if ("MICROSOFT_MIT_SMALL_NO_CODEGEN".equals(value)) { - header = MICROSOFT_MIT_SMALL_LICENSE_HEADER; - } else { - header = value; - } - } - - static void setHost(NewPlugin host) { - JavaSettings.host = host; - logger = new PluginLogger(host, JavaSettings.class); - } - - /** - * Clear the JavaSettings instance. - */ - public static void clear() { - instance = null; - } - - /** - * Get the JavaSettings instance. - * - * @return The JavaSettings instance. - */ - public static JavaSettings getInstance() { - if (instance == null) { - AutorestSettings autorestSettings = new AutorestSettings(); - loadStringSetting("title", autorestSettings::setTitle); - loadStringOrArraySettingAsArray("security", autorestSettings::setSecurity); - loadStringOrArraySettingAsArray("security-scopes", autorestSettings::setSecurityScopes); - loadStringSetting("security-header-name", autorestSettings::setSecurityHeaderName); - - loadStringSetting("tag", autorestSettings::setTag); - loadStringSetting("base-folder", autorestSettings::setBaseFolder); - loadStringSetting("output-folder", autorestSettings::setOutputFolder); - loadStringSetting("java-sdks-folder", autorestSettings::setJavaSdksFolder); - // input-file - List inputFiles = host.getValueWithJsonReader("input-file", - jsonReader -> jsonReader.readArray(JsonReader::getString)); - if (inputFiles != null) { - autorestSettings.getInputFiles().addAll(inputFiles); - logger.debug("List of input files : {}", autorestSettings.getInputFiles()); - } - // require (readme.md etc.) - List require = host.getValueWithJsonReader("require", - jsonReader -> jsonReader.readArray(JsonReader::getString)); - if (require != null) { - autorestSettings.getRequire().addAll(require); - logger.debug("List of require : {}", autorestSettings.getRequire()); - } - - String fluent = getStringValue(host, "fluent"); - - setHeader(getStringValue(host, "license-header")); - instance = new JavaSettings( - autorestSettings, - host.getValueWithJsonReader("modelerfour", jsonReader -> jsonReader.readMap(JsonReader::readUntyped)), - getBooleanValue(host, "azure-arm", false), - getBooleanValue(host, "sdk-integration", false), - fluent, - getBooleanValue(host, "regenerate-pom", false), - header, - getStringValue(host, "service-name"), - getStringValue(host, "namespace", "com.mycompany.app").toLowerCase(), - getBooleanValue(host, "client-side-validations", false), - getStringValue(host, "client-type-prefix"), - getBooleanValue(host, "generate-client-interfaces", false), - getBooleanValue(host, "generate-client-as-impl", false), - getStringValue(host, "implementation-subpackage", "implementation"), - getStringValue(host, "models-subpackage", "models"), - getStringValue(host, "custom-types", ""), - getStringValue(host, "custom-types-subpackage", ""), - getStringValue(host, "fluent-subpackage", "fluent"), - getBooleanValue(host, "required-parameter-client-methods", false), - getBooleanValue(host, "generate-sync-async-clients", false), - getBooleanValue(host, "generate-builder-per-client", false), - getStringValue(host, "sync-methods", "essential"), - getBooleanValue(host, "client-logger", false), - getBooleanValue(host, "required-fields-as-ctor-args", false), - getBooleanValue(host, "service-interface-as-public", true), - getStringValue(host, "artifact-id", ""), - getStringValue(host, "credential-types", "none"), - getStringValue(host, "credential-scopes"), - getStringValue(host, "customization-jar-path"), - getStringValue(host, "customization-class"), - getBooleanValue(host, "optional-constant-as-enum", false), - getBooleanValue(host, "data-plane", false), - getBooleanValue(host, "use-iterable", false), - host.getValueWithJsonReader("service-versions", jsonReader -> jsonReader.readArray(JsonReader::getString)), - getStringValue(host, "client-flattened-annotation-target", ""), - getStringValue(host, "key-credential-header-name", ""), - getBooleanValue(host, "disable-client-builder", false), - host.getValueWithJsonReader("polling", jsonReader -> jsonReader.readMap(PollingDetails::fromJson)), - getBooleanValue(host, "generate-samples", false), - getBooleanValue(host, "generate-tests", false), - false, //getBooleanValue(host, "generate-send-request-method", false), - getBooleanValue(host, "annotate-getters-and-setters-for-serialization", false), - getStringValue(host, "default-http-exception-type"), - getBooleanValue(host, "use-default-http-status-code-to-exception-type-mapping", false), - host.getValueWithJsonReader("http-status-code-to-exception-type-mapping", JavaSettings::parseStatusCodeMapping), - getBooleanValue(host, "partial-update", false), - // If fluent default to false, this is because the automated test generation ends up with invalid code. - // Once that is fixed, this can be switched over to true. - getBooleanValue(host, "generic-response-type", fluent == null), - getBooleanValue(host, "stream-style-serialization", true), - getBooleanValue(host, "enable-sync-stack", false), - getBooleanValue(host, "output-model-immutable", false), - getBooleanValue(host, "use-input-stream-for-binary", false), - getBooleanValue(host, "no-custom-headers", true), - getBooleanValue(host, "include-read-only-in-constructor-args", false), - // setting the default as true as the Java design guideline recommends using String for URLs. - getBooleanValue(host, "url-as-string", true), - getBooleanValue(host, "uuid-as-string", false), - - // setting this to false by default as a lot of existing libraries still use swagger and - // were generated with required = true set in JsonProperty annotation - getBooleanValue(host, "disable-required-property-annotation", false), - getBooleanValue(host, "enable-page-size", false), - getBooleanValue(host, "use-key-credential", false), - getBooleanValue(host, "null-byte-array-maps-to-empty-array", false), - getBooleanValue(host, "graal-vm-config", false), - getStringValue(host, "flavor", "Azure"), - getBooleanValue(host, "disable-typed-headers-methods", false), - getBooleanValue(host, "share-jsonserializable-code", false), - getBooleanValue(host, "android", false) - ); - } - return instance; - } - - private static Map parseStatusCodeMapping(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Map mapping = new HashMap<>(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - int key = Integer.parseInt(reader.getFieldName()); - reader.nextToken(); - mapping.put(key, reader.getString()); - } - - return mapping; - }); - } - - /** - * Create a new JavaSettings object with the provided properties. - * - * @param autorestSettings The autorest settings. - * @param modelerSettings The modeler settings. - * @param azure Whether to generate the Azure. - * @param sdkIntegration Whether to generate the SDK integration. - * @param fluent The fluent generation mode. - * @param regeneratePom Whether to regenerate the POM. - * @param fileHeaderText The file header text. - * @param serviceName The service name. - * @param packageKeyword The package keyword. - * @param clientSideValidations Whether to add client-side validations to the generated clients. - * @param clientTypePrefix The prefix that will be added to each generated client type. - * @param generateClientInterfaces Whether interfaces will be generated for Service and Method Group clients. - * @param generateClientAsImpl Whether Service and Method Group clients will be generated as implementation - * @param implementationSubpackage The sub-package that the Service and Method Group client implementation classes - * will be put into. - * @param modelsSubpackage The sub-package that Enums, Exceptions, and Model types will be put into. - * @param customTypes The custom types that will be generated. - * @param customTypesSubpackage The sub-package that custom types will be put into. - * @param fluentSubpackage The sub-package that Fluent interfaces will be put into. - * @param requiredParameterClientMethods Whether Service and Method Group client method overloads that omit optional - * parameters will be created. - * @param generateSyncAsyncClients Whether Service and Method Group clients will be generated with both synchronous - * and asynchronous methods. - * @param generateBuilderPerClient Whether a builder will be generated for each Service and Method Group client. - * @param syncMethods The sync methods generation mode. - * @param clientLogger Whether to add a logger to the generated clients. - * @param requiredFieldsAsConstructorArgs Whether required fields will be included in the constructor arguments for - * generated models. - * @param serviceInterfaceAsPublic If set to true, proxy method service interface will be marked as public. - * @param artifactId The artifactId for the generated project. - * @param credentialType The type of credential to generate. - * @param credentialScopes The scopes for the generated credential. - * @param customizationJarPath The path to the customization jar. - * @param customizationClass The class to use for customization. - * @param optionalConstantAsEnum Whether to generate optional constants as enums. - * @param dataPlaneClient Whether to generate a data plane client. - * @param useIterable Whether to use Iterable instead of List for collection types. - * @param serviceVersions The versions of the service. - * @param clientFlattenAnnotationTarget The target for the @JsonFlatten annotation for - * x-ms-client-flatten. - * @param keyCredentialHeaderName The header name for the key credential. - * @param clientBuilderDisabled Whether to disable the client builder. - * @param pollingConfig The polling configuration. - * @param generateSamples Whether to generate samples. - * @param generateTests Whether to generate tests. - * @param generateSendRequestMethod Whether to generate the send request method. - * @param annotateGettersAndSettersForSerialization If set to true, Jackson JsonGetter and JsonSetter will annotate - * getters and setters in generated models to handle serialization and deserialization. For now, fields will - * continue being annotated to ensure that there are no backwards compatibility breaks. - * @param defaultHttpExceptionType The fully-qualified class that should be used as the default exception type. This - * class must extend from HttpResponseException. - * @param useDefaultHttpStatusCodeToExceptionTypeMapping Determines whether a well-known HTTP status code to - * exception type mapping should be used if an HTTP status code-exception mapping isn't provided. - * @param httpStatusCodeToExceptionTypeMapping A mapping of HTTP response status code to the exception type that - * should be thrown if that status code is seen. All exception types must be fully-qualified and extend from - * HttpResponseException. - * @param handlePartialUpdate If set to true, the generated model will handle partial updates. - * @param genericResponseTypes If set to true, responses will only use Response, ResponseBase, PagedResponse, and - * PagedResponseBase types with generics instead of creating a specific named type that extends one of those types. - * @param streamStyleSerialization If set to true, models will handle serialization themselves using stream-style - * serialization instead of relying on Jackson Databind. - * @param isSyncStackEnabled If set to true, sync methods are generated using sync stack. i.e these methods do - * not use sync-over-async stack. - * @param outputModelImmutable If set to true, the models that are determined as output only models will be made - * immutable without any public constructors or setter methods. - * @param streamResponseInputStream If set to true, sync methods will use {@code InputStream} for binary responses. - * @param noCustomHeaders If set to true, methods that have custom header types will also have an equivalent - * method that returns just the response with untyped headers. - * @param includeReadOnlyInConstructorArgs If set to true, read-only required properties will be included in the - * constructor if {@code requiredFieldsAsConstructorArgs} is true. This is a backwards compatibility flag as - * previously read-only required were included in constructors. - * @param urlAsString This generates all URLs as String type. This is enabled by default as required by the Java - * design guidelines. For backward compatibility, this can be set to false. - * @param disableRequiredPropertyAnnotation If set to true, the required property annotation will be disabled. - * @param pageSizeEnabled If set to true, the generated client will have support for page size. - * @param useKeyCredential If set to true, the generated client will have support for key credential. - * @param nullByteArrayMapsToEmptyArray If set to true, {@code ArrayType.BYTE_ARRAY} will return an empty array - * instead of null when the default value expression is null. - * @param generateGraalVmConfig If set to true, the generated client will have support for GraalVM. - * @param flavor The brand name we use to generate SDK. - * @param disableTypedHeadersMethods Prevents generating REST API methods that include typed headers. If set to - * true, {@code noCustomHeaders} will be ignored as no REST APIs with typed headers will be generated. - * @param shareJsonSerializableCode Whether models implementing {@code JsonSerializable} can attempt to share code - * for {@code toJson} and {@code fromJson}. - * @param android Whether to generate the Android client. - */ - private JavaSettings(AutorestSettings autorestSettings, - Map modelerSettings, - boolean azure, - boolean sdkIntegration, - String fluent, - boolean regeneratePom, - String fileHeaderText, - String serviceName, - String packageKeyword, - boolean clientSideValidations, - String clientTypePrefix, - boolean generateClientInterfaces, - boolean generateClientAsImpl, - String implementationSubpackage, - String modelsSubpackage, - String customTypes, - String customTypesSubpackage, - String fluentSubpackage, - boolean requiredParameterClientMethods, - boolean generateSyncAsyncClients, - boolean generateBuilderPerClient, - String syncMethods, - boolean clientLogger, - boolean requiredFieldsAsConstructorArgs, - boolean serviceInterfaceAsPublic, - String artifactId, - String credentialType, - String credentialScopes, - String customizationJarPath, - String customizationClass, - boolean optionalConstantAsEnum, - boolean dataPlaneClient, - boolean useIterable, - List serviceVersions, - String clientFlattenAnnotationTarget, - String keyCredentialHeaderName, - boolean clientBuilderDisabled, - Map pollingConfig, - boolean generateSamples, - boolean generateTests, - boolean generateSendRequestMethod, - boolean annotateGettersAndSettersForSerialization, - String defaultHttpExceptionType, - boolean useDefaultHttpStatusCodeToExceptionTypeMapping, - Map httpStatusCodeToExceptionTypeMapping, - boolean handlePartialUpdate, - boolean genericResponseTypes, - boolean streamStyleSerialization, - boolean isSyncStackEnabled, - boolean outputModelImmutable, - boolean streamResponseInputStream, - boolean noCustomHeaders, - boolean includeReadOnlyInConstructorArgs, - boolean urlAsString, - boolean uuidAsString, - boolean disableRequiredPropertyAnnotation, - boolean pageSizeEnabled, - boolean useKeyCredential, - boolean nullByteArrayMapsToEmptyArray, - boolean generateGraalVmConfig, - String flavor, - boolean disableTypedHeadersMethods, - boolean shareJsonSerializableCode, - boolean android) { - - this.autorestSettings = autorestSettings; - this.modelerSettings = new ModelerSettings(modelerSettings); - this.azure = azure; - this.sdkIntegration = sdkIntegration; - this.fluent = fluent == null ? Fluent.NONE : (fluent.isEmpty() || fluent.equalsIgnoreCase("true") - ? Fluent.PREMIUM : Fluent.valueOf(fluent.toUpperCase(Locale.ROOT))); - this.regeneratePom = regeneratePom; - this.fileHeaderText = fileHeaderText; - this.serviceName = serviceName; - this.packageName = packageKeyword; - this.clientSideValidations = clientSideValidations; - this.clientTypePrefix = clientTypePrefix; - this.generateClientInterfaces = generateClientInterfaces; - this.generateClientAsImpl = generateClientAsImpl || generateSyncAsyncClients || generateClientInterfaces; - this.implementationSubpackage = implementationSubpackage; - this.modelsSubpackage = modelsSubpackage; - this.customTypes = (customTypes == null || customTypes.isEmpty()) - ? new ArrayList<>() : Arrays.asList(customTypes.split(",")); - this.customTypesSubpackage = customTypesSubpackage; - this.fluentSubpackage = fluentSubpackage; - this.requiredParameterClientMethods = requiredParameterClientMethods; - this.generateSyncAsyncClients = generateSyncAsyncClients; - this.generateBuilderPerClient = generateBuilderPerClient; - this.syncMethods = SyncMethodsGeneration.fromValue(syncMethods); - this.clientLogger = clientLogger; - this.requiredFieldsAsConstructorArgs = requiredFieldsAsConstructorArgs; - this.serviceInterfaceAsPublic = serviceInterfaceAsPublic; - this.artifactId = artifactId; - this.optionalConstantAsEnum = optionalConstantAsEnum; - this.dataPlaneClient = dataPlaneClient; - this.useIterable = useIterable; - this.serviceVersions = serviceVersions; - this.clientFlattenAnnotationTarget = - (clientFlattenAnnotationTarget == null || clientFlattenAnnotationTarget.isEmpty()) - ? ClientFlattenAnnotationTarget.TYPE - : ClientFlattenAnnotationTarget.valueOf(clientFlattenAnnotationTarget.toUpperCase(Locale.ROOT)); - - if (credentialType != null) { - String[] splits = credentialType.split(","); - this.credentialTypes = Arrays.stream(splits) - .map(String::trim) - .map(CredentialType::fromValue) - .collect(Collectors.toSet()); - } - if (credentialScopes != null) { - String[] splits = credentialScopes.split(","); - this.credentialScopes = Arrays.stream(splits) - .map(String::trim) - .map(split -> { - if (!split.startsWith("\"")) { - split = "\"" + split + "\""; - } - return split; - }) - .collect(Collectors.toSet()); - } - this.customizationJarPath = customizationJarPath; - this.customizationClass = customizationClass; - this.keyCredentialHeaderName = keyCredentialHeaderName; - this.clientBuilderDisabled = clientBuilderDisabled; - if (pollingConfig != null) { - if (!pollingConfig.containsKey("default")) { - pollingConfig.put("default", new PollingDetails()); - } - } - this.pollingConfig = pollingConfig; - this.generateSamples = generateSamples; - this.generateTests = generateTests; - this.generateSendRequestMethod = generateSendRequestMethod; - this.annotateGettersAndSettersForSerialization = annotateGettersAndSettersForSerialization; - - // Error HTTP status code exception type handling. - this.defaultHttpExceptionType = defaultHttpExceptionType; - this.useDefaultHttpStatusCodeToExceptionTypeMapping = useDefaultHttpStatusCodeToExceptionTypeMapping; - this.httpStatusCodeToExceptionTypeMapping = httpStatusCodeToExceptionTypeMapping; - - this.handlePartialUpdate = handlePartialUpdate; - - this.genericResponseTypes = genericResponseTypes; - - this.streamStyleSerialization = streamStyleSerialization; - this.syncStackEnabled = isSyncStackEnabled; - - this.outputModelImmutable = outputModelImmutable; - - this.isInputStreamForBinary = streamResponseInputStream; - this.noCustomHeaders = noCustomHeaders; - this.includeReadOnlyInConstructorArgs = includeReadOnlyInConstructorArgs; - this.urlAsString = urlAsString; - this.uuidAsString = uuidAsString; - this.disableRequiredJsonAnnotation = disableRequiredPropertyAnnotation; - this.pageSizeEnabled = pageSizeEnabled; - this.useKeyCredential = useKeyCredential; - this.nullByteArrayMapsToEmptyArray = nullByteArrayMapsToEmptyArray; - this.generateGraalVmConfig = generateGraalVmConfig; - this.flavor = flavor; - this.disableTypedHeadersMethods = disableTypedHeadersMethods; - this.shareJsonSerializableCode = shareJsonSerializableCode; - this.android = android; - } - - /** - * Whether to generate with Azure branding. - * - * @return Whether to generate with Azure branding. - */ - public boolean isBranded() { - return "azure".equalsIgnoreCase(this.flavor); - } - - private final String keyCredentialHeaderName; - - /** - * The header name for the key credential. - * - * @return The header name for the key credential. - */ - public String getKeyCredentialHeaderName() { - return this.keyCredentialHeaderName; - } - - - private Set credentialTypes; - - /** - * The types of credentials to generate. - * - * @return The types of credentials to generate. - */ - public Set getCredentialTypes() { - return credentialTypes; - } - - - private Set credentialScopes; - - /** - * The scopes for the generated credential. - * - * @return The scopes for the generated credential. - */ - public Set getCredentialScopes() { - return credentialScopes; - } - - - private final boolean azure; - - /** - * Whether to generate the Azure. - * - * @return Whether to generate the Azure. - */ - public final boolean isAzure() { - return azure; - } - - - private final String artifactId; - - /** - * The artifactId for the generated project. - * - * @return The artifactId for the generated project. - */ - public String getArtifactId() { - return artifactId; - } - - /** - * Whether to disable custom headers type generation. - * - * @return Whether to disable custom headers type generation. - */ - public boolean isNoCustomHeaders() { - return noCustomHeaders; - } - - - private final boolean urlAsString; - - /** - * Whether to generate all URLs as String type. This is enabled by default as required by the Java design - * guidelines. For backward compatibility, this can be set to false. - * - * @return Whether to generate all URLs as String type. - */ - public boolean urlAsString() { - return urlAsString; - } - - private final boolean uuidAsString; - - /** - * Whether to use string for uuid. - * - * @return Whether to use string for uuid. - */ - public boolean uuidAsString() { - return uuidAsString; - } - - private final boolean disableRequiredJsonAnnotation; - - /** - * Whether to disable the required property annotation. - * - * @return Whether to disable the required property annotation. - */ - public boolean isDisableRequiredJsonAnnotation() { - return disableRequiredJsonAnnotation; - } - - /** - * Represents Fluent generation mode. - */ - public enum Fluent { - /** - * No Fluent generation. - */ - NONE, - /** - * Fluent Lite generation. - */ - LITE, - /** - * Fluent Premium generation. - */ - PREMIUM; - - /** - * Gets a {@link Fluent} value for the give {@code value} string. - * - * @param value The value to parse. - * @return The {@link Fluent} value. - */ - public static Fluent fromString(String value) { - if (value == null || value.isEmpty()) { - return null; - } - - if ("none".equalsIgnoreCase(value)) { - return NONE; - } else if ("lite".equalsIgnoreCase(value)) { - return LITE; - } else if ("premium".equalsIgnoreCase(value)) { - return PREMIUM; - } else { - return null; - } - } - } - - private final Fluent fluent; - - /** - * Whether to generate the Fluent. - * - * @return Whether to generate the Fluent. - */ - public final boolean isFluent() { - return fluent != Fluent.NONE; - } - - /** - * Whether to generate Fluent Lite. - * - * @return Whether to generate Fluent Lite. - */ - public final boolean isFluentLite() { - return fluent == Fluent.LITE; - } - - /** - * Whether to generate Fluent Premium. - * - * @return Whether to generate Fluent Premium. - */ - public final boolean isFluentPremium() { - return fluent == Fluent.PREMIUM; - } - - /** - * Whether to generate the Azure or Fluent. - * - * @return Whether to generate the Azure or Fluent. - */ - public final boolean isAzureOrFluent() { - return isAzure() || isFluent(); - } - - // configure for model flatten in client - - /** - * Represents the target for the @JsonFlatten annotation for x-ms-client-flatten. - */ - public enum ClientFlattenAnnotationTarget { - /** - * JsonFlatten on class - */ - TYPE, - /** - * JsonFlatten on class variable - */ - FIELD, - /** - * Do not use @JsonFlatten. The model flatten is implemented as class variable getter/setter access the - * flattened properties. - */ - NONE, - /** - * Disable the model flatten - */ - DISABLED - } - - // target for @JsonFlatten annotation for x-ms-client-flatten - private final ClientFlattenAnnotationTarget clientFlattenAnnotationTarget; - - /** - * When flatten client mode, where to put the @JsonFlatten annotation. If NONE, flatten at - * getter/setter methods via codegen. - * - * @return When flatten client mode, where to put the @JsonFlatten annotation. If NONE, flatten at - * getter/setter methods via codegen. - */ - public ClientFlattenAnnotationTarget getClientFlattenAnnotationTarget() { - return this.clientFlattenAnnotationTarget; - } - - /** - * Represents the settings that are used by the modeler. - */ - public static class ModelerSettings { - private final Map settings; - - /** - * Create a new ModelerSettings object with the provided settings. - * - * @param settings The settings that are used by the modeler. - */ - public ModelerSettings(Map settings) { - this.settings = settings == null ? Collections.emptyMap() : settings; - } - - /** - * Get the settings that are used by the modeler. - * - * @return The settings that are used by the modeler. - */ - public Map getSettings() { - return settings; - } - - /** - * If false, use client-flattened-annotation-target = TYPE for no flatten; client-flattened-annotation-target = - * NONE for flatten at getter/setter methods via codegen. - *

- * If true, use client-flattened-annotation-target = TYPE for @JsonFlatten on type (i.e. on class); - * client-flattened-annotation-target = FIELD for @JsonFlatten on field. - *

- * modelerfour.flatten-models = false and client-flattened-annotation-target = NONE would require - * modelerfour.flatten-payloads = false. - * - * @return value of modelerfour.flatten-models - */ - public boolean isFlattenModel() { - return settings.containsKey("flatten-models") && (boolean) settings.get("flatten-models"); - } - } - - private final ModelerSettings modelerSettings; - - /** - * The settings that are used by the modeler. - * - * @return The settings that are used by the modeler. - */ - public ModelerSettings getModelerSettings() { - return modelerSettings; - } - - private final AutorestSettings autorestSettings; - - /** - * The settings that are used by the AutoRest generator. - * - * @return The settings that are used by the AutoRest generator. - */ - public AutorestSettings getAutorestSettings() { - return autorestSettings; - } - - /** - * The settings that are used by the AutoRest generator. - * - * @return The settings that are used by the AutoRest generator. - */ - public Map getSimpleJavaSettings() { - return SIMPLE_JAVA_SETTINGS; - } - - private final boolean sdkIntegration; - - /** - * Whether to generate the SDK integration. - * - * @return Whether to generate the SDK integration. - */ - public boolean isSdkIntegration() { - return sdkIntegration; - } - - private final boolean regeneratePom; - - /** - * Whether to regenerate the pom file. - * - * @return Whether to regenerate the pom file. - */ - public final boolean isRegeneratePom() { - return regeneratePom; - } - - private final String fileHeaderText; - - /** - * Get the file header text. - * - * @return The file header text. - */ - public final String getFileHeaderText() { - return fileHeaderText; - } - - private final String serviceName; - - /** - * Get the service name. - * - * @return The service name. - */ - public final String getServiceName() { - return serviceName; - } - - private final String packageName; - - /** - * Get the package name. - * - * @return The package name. - */ - public final String getPackage() { - return packageName; - } - - /** - * Get the package name with the provided package suffixes appended. - * - * @param packageSuffixes The package suffixes to append to the package name. - * @return The package name with the provided package suffixes appended. - */ - public final String getPackage(String... packageSuffixes) { - StringBuilder packageBuilder = new StringBuilder(packageName); - if (packageSuffixes != null) { - for (String packageSuffix : packageSuffixes) { - if (packageSuffix != null && !packageSuffix.isEmpty()) { - // Cleanse the package suffix to remove leading and trailing periods. - boolean startsWithPeriod = packageSuffix.startsWith("."); - boolean endsWithPeriod = packageSuffix.endsWith("."); - - String cleansedPackageSuffix; - if (startsWithPeriod && endsWithPeriod) { - cleansedPackageSuffix = packageSuffix.substring(1, packageSuffix.length() - 1); - } else if (startsWithPeriod) { - cleansedPackageSuffix = packageSuffix.substring(1); - } else if (endsWithPeriod) { - cleansedPackageSuffix = packageSuffix.substring(0, packageSuffix.length() - 1); - } else { - cleansedPackageSuffix = packageSuffix; - } - - packageBuilder.append(".").append(cleansedPackageSuffix); - } - } - } - return packageBuilder.toString(); - } - - private final boolean clientSideValidations; - - /** - * Whether to add client side validations to the generated clients. - * - * @return Whether to add client side validations to the generated clients. - */ - public final boolean isClientSideValidations() { - return clientSideValidations; - } - - /** - * The prefix that will be added to each generated client type. - */ - private final String clientTypePrefix; - - /** - * The prefix that will be added to each generated client type. - * - * @return The prefix that will be added to each generated client type. - */ - public final String getClientTypePrefix() { - return clientTypePrefix; - } - - /** - * Whether interfaces will be generated for Service and Method Group clients. - */ - private final boolean generateClientInterfaces; - - /** - * Whether interfaces will be generated for Service and Method Group clients. - * - * @return Whether interfaces will be generated for Service and Method Group clients. - */ - public final boolean isGenerateClientInterfaces() { - return generateClientInterfaces; - } - - /** - * Whether interfaces will be generated for Service and Method Group clients. - */ - private final boolean generateClientAsImpl; - - /** - * Whether interfaces will be generated for Service and Method Group clients. - * - * @return Whether interfaces will be generated for Service and Method Group clients. - */ - public final boolean isGenerateClientAsImpl() { - return generateClientAsImpl; - } - - /** - * The sub-package that the Service and Method Group client implementation classes will be put into. - */ - private final String implementationSubpackage; - - /** - * The sub-package that the Service and Method Group client implementation classes will be put into. - * - * @return The sub-package that the Service and Method Group client implementation classes will be put into. - */ - public final String getImplementationSubpackage() { - return implementationSubpackage; - } - - /** - * The sub-package that Enums, Exceptions, and Model types will be put into. - */ - private final String modelsSubpackage; - - /** - * The sub-package that Enums, Exceptions, and Model types will be put into. - * - * @return The sub-package that Enums, Exceptions, and Model types will be put into. - */ - public final String getModelsSubpackage() { - return modelsSubpackage; - } - - private final String fluentSubpackage; - - /** - * The sub-package for Fluent SDK, that contains Client and Builder types, which is not recommended to be used - * directly. - * - * @return The sub-package for Fluent SDK, that contains Client and Builder types, which is not recommended to be - * used directly. - */ - public final String getFluentSubpackage() { - return fluentSubpackage; - } - - /** - * The sub-package for Fluent SDK, that contains Enums, Exceptions, and Model types, which is not recommended being - * used directly. - * - * @return The sub-package for Fluent SDK, that contains Enums, Exceptions, and Model types, which is not - * recommended being used directly. - */ - public final String getFluentModelsSubpackage() { - if (modelsSubpackage.contains(".")) { - return fluentSubpackage + "." + modelsSubpackage.substring(modelsSubpackage.lastIndexOf(".") + 1); - } else { - return fluentSubpackage + "." + modelsSubpackage; - } - } - - /** - * Whether Service and Method Group client method overloads that omit optional parameters will be created. - */ - private final boolean requiredParameterClientMethods; - - /** - * Whether Service and Method Group client method overloads that omit optional parameters will be created. - * - * @return Whether Service and Method Group client method overloads that omit optional parameters will be created. - */ - public final boolean isRequiredParameterClientMethods() { - return requiredParameterClientMethods; - } - - private final boolean generateSyncAsyncClients; - - /** - * Whether sync methods are generated using sync stack. i.e these methods do not use sync-over-async stack. - * - * @return Whether sync methods are generated using sync stack. - */ - public final boolean isGenerateSyncAsyncClients() { - return generateSyncAsyncClients; - } - - /** - * Whether sync methods are generated using sync stack. i.e these methods do not use sync-over-async stack. - * - * @return Whether sync methods are generated using sync stack. - */ - public final boolean isSyncClientWrapAsyncClient() { - return !syncStackEnabled; - } - - private final SyncMethodsGeneration syncMethods; - - /** - * Get the sync methods generation. - * - * @return The sync methods generation. - */ - public final SyncMethodsGeneration getSyncMethods() { - return syncMethods; - } - - /** - * Whether to generate async methods. - * - * @return Whether to generate async methods. - */ - public final boolean isGenerateAsyncMethods() { - SyncMethodsGeneration syncMethodsGeneration = getSyncMethods(); - return syncMethodsGeneration == SyncMethodsGeneration.ALL - || syncMethodsGeneration == SyncMethodsGeneration.ESSENTIAL; - } - - /** - * Whether to generate sync methods. - * - * @return Whether to generate sync methods. - */ - public final boolean isGenerateSyncMethods() { - SyncMethodsGeneration syncMethodsGeneration = getSyncMethods(); - return syncMethodsGeneration == SyncMethodsGeneration.ALL - || syncMethodsGeneration == SyncMethodsGeneration.SYNC_ONLY; - } - - private final boolean requiredFieldsAsConstructorArgs; - - /** - * Whether required fields will be included as constructor arguments. - * - * @return Whether required fields will be included as constructor arguments. - */ - public boolean isRequiredFieldsAsConstructorArgs() { - return requiredFieldsAsConstructorArgs; - } - - private final boolean serviceInterfaceAsPublic; - - /** - * Whether proxy method service interface will be marked as public. - * - * @return Whether proxy method service interface will be marked as public. - */ - public boolean isServiceInterfaceAsPublic() { - return serviceInterfaceAsPublic; - } - - /** - * Represents sync methods generation. - */ - public enum SyncMethodsGeneration { - /** - * Generate all methods. - */ - ALL, - - /** - * Generate only essential methods. - */ - ESSENTIAL, - - /** - * Generate only sync methods. - */ - SYNC_ONLY, // SYNC_ONLY requires "enable-sync-stack" - - /** - * Generate no methods. - */ - NONE; - - /** - * Convert the string value to the enum value. - * - * @param value The string value. - * @return The enum value. - */ - public static SyncMethodsGeneration fromValue(String value) { - if (value == null) { - return null; - } else if (value.equals("all")) { - return ALL; - } else if (value.equals("essential")) { - return ESSENTIAL; - } else if (value.equals("none")) { - return NONE; - } else if (value.equals("sync-only")) { - return SYNC_ONLY; - } - return null; - } - } - - private final List customTypes; - - /** - * The list of custom types. - * - * @return The list of custom types. - */ - public List getCustomTypes() { - return customTypes; - } - - /** - * Whether the given type name is a custom type. - * - * @param typeName The type name. - * @return Whether the given type name is a custom type. - */ - public boolean isCustomType(String typeName) { - return customTypes.contains(typeName); - } - - private final String customTypesSubpackage; - - /** - * The sub-package that custom types will be put into. - * - * @return The sub-package that custom types will be put into. - */ - public final String getCustomTypesSubpackage() { - return customTypesSubpackage; - } - - /** - * Represents the type of credential. - */ - public enum CredentialType { - /** - * Token credential. - */ - TOKEN_CREDENTIAL, - - /** - * Azure key credential. - */ - AZURE_KEY_CREDENTIAL, - - /** - * No credential. - */ - NONE; - - /** - * Convert the string value to the enum value. - * - * @param value The string value. - * @return The enum value. - */ - public static CredentialType fromValue(String value) { - if (value == null) { - return null; - } else if (value.equals("tokencredential")) { - return TOKEN_CREDENTIAL; - } else if (value.equals("azurekeycredential")) { - return AZURE_KEY_CREDENTIAL; - } else if (value.equals("none")) { - return NONE; - } - return NONE; - } - } - - private final boolean clientLogger; - - /** - * Whether to use client logger. - * - * @return Whether to use client logger. - */ - public final boolean isUseClientLogger() { - return clientLogger; - } - - private final String customizationJarPath; - - /** - * The path to the customization jar. - * - * @return The path to the customization jar. - */ - public final String getCustomizationJarPath() { - return customizationJarPath; - } - - private final String customizationClass; - - /** - * The fully qualified class name of the customization class. - * - * @return The fully qualified class name of the customization class. - */ - public final String getCustomizationClass() { - return customizationClass; - } - - private final boolean optionalConstantAsEnum; - - /** - * Whether to generate optional constants as enum. - * - * @return Whether to generate optional constants as enum. - */ - public boolean isOptionalConstantAsEnum() { - return optionalConstantAsEnum; - } - - private final boolean dataPlaneClient; - - /** - * Whether the client is a data plane client. - * - * @return Whether the client is a data plane client. - */ - - public boolean isDataPlaneClient() { - return dataPlaneClient; - } - - private final boolean useIterable; - - /** - * Whether to use Iterable for list type properties. - * - * @return whether to use Iterable for list type properties. - */ - public boolean isUseIterable() { - return useIterable; - } - - /** - * Service version list. It maps to api-version parameter in swagger. Last one is the latest version, also default - * version - */ - private final List serviceVersions; - - /** - * Service version list. It maps to api-version parameter in swagger. Last one is the latest version, also - * default version - * - * @return Service version list. It maps to api-version parameter in swagger. Last one is the latest version, also - * default version - */ - public List getServiceVersions() { - return serviceVersions; - } - - private final boolean generateSamples; - - /** - * Whether to generate samples. - * - * @return Whether to generate samples. - */ - public boolean isGenerateSamples() { - return generateSamples; - } - - private final boolean generateTests; - - /** - * Whether to generate tests. - * - * @return Whether to generate tests. - */ - public boolean isGenerateTests() { - return generateTests; - } - - private final boolean generateSendRequestMethod; - - /** - * Whether to generate the send request method. - * - * @return Whether to generate the send request method. - */ - public boolean isGenerateSendRequestMethod() { - return generateSendRequestMethod; - } - - private final boolean syncStackEnabled; - - /** - * Whether to enable sync stack. - * - * @return Whether to enable sync stack. - */ - public boolean isSyncStackEnabled() { - return syncStackEnabled; - } - - private final boolean clientBuilderDisabled; - - /** - * Whether to disable the client builder. - * - * @return Whether to disable the client builder. - */ - public boolean clientBuilderDisabled() { - return clientBuilderDisabled; - } - - private final boolean outputModelImmutable; - - /** - * Whether the models that are determined as output only models will be made immutable without any public - * constructors or setter methods. - * - * @return Whether the models that are determined as output only models will be made immutable without any public - * constructors or setter methods. - */ - public boolean isOutputModelImmutable() { - return outputModelImmutable; - } - - private final boolean pageSizeEnabled; - - /** - * Whether to enable page size. - * - * @return Whether to enable page size. - */ - public boolean isPageSizeEnabled() { - return pageSizeEnabled; - } - - private final boolean generateGraalVmConfig; - - /** - * Whether to generate a GraalVM configuration file. - * - * @return Whether to generate a GraalVM configuration file. - */ - public boolean isGenerateGraalVmConfig() { - return generateGraalVmConfig; - } - - /** - * Represents the details of polling for a long-running operation. - */ - public static class PollingDetails implements JsonSerializable { - private String strategy; - private String syncStrategy; - private String intermediateType; - private String finalType; - private String pollInterval; - - /** - * Creates a new PollingDetails object. - */ - public PollingDetails() { - } - - /** - * The default polling strategy format. - */ - public static final String DEFAULT_POLLING_STRATEGY_FORMAT = String.join("\n", - "new %s<>(new PollingStrategyOptions({httpPipeline})", - " .setEndpoint({endpoint})", - " .setContext({context})", - " .setServiceVersion({serviceVersion}))"); - - private static final String DEFAULT_POLLING_CODE - = String.format(DEFAULT_POLLING_STRATEGY_FORMAT, "DefaultPollingStrategy"); - - private static final String DEFAULT_SYNC_POLLING_CODE - = String.format(DEFAULT_POLLING_STRATEGY_FORMAT, "SyncDefaultPollingStrategy"); - - /** - * Gets the strategy for polling. - * - * @return The strategy for polling. - */ - public String getStrategy() { - if (strategy == null || "default".equalsIgnoreCase(strategy)) { - return DEFAULT_POLLING_CODE; - } else { - return strategy; - } - } - - /** - * Gets the sync strategy for polling. - * - * @return The sync strategy for polling. - */ - public String getSyncStrategy() { - if (syncStrategy == null || "default".equalsIgnoreCase(syncStrategy)) { - return DEFAULT_SYNC_POLLING_CODE; - } else { - return syncStrategy; - } - } - - /** - * Gets the intermediate type for polling. - * - * @return The intermediate type for polling. - */ - public String getIntermediateType() { - return intermediateType; - } - - /** - * Gets the final type for polling. - * - * @return The final type for polling. - */ - public String getFinalType() { - return finalType; - } - - /** - * Gets the polling interval in seconds. - * - * @return The polling interval in seconds. - */ - public int getPollIntervalInSeconds() { - return pollInterval != null ? Integer.parseInt(pollInterval) : 1; - } - - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return jsonWriter.writeStartObject() - .writeStringField("strategy", strategy) - .writeStringField("sync-strategy", syncStrategy) - .writeStringField("intermediate-type", intermediateType) - .writeStringField("final-type", finalType) - .writeStringField("poll-interval", pollInterval) - .writeEndObject(); - } - - /** - * Deserializes a PollingDetails instance from the JSON data. - * - * @param jsonReader The JSON reader to deserialize from. - * @return A PollingDetails instance deserialized from the JSON data. - * @throws IOException If an error occurs during deserialization. - */ - public static PollingDetails fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PollingDetails pollingDetails = new PollingDetails(); - - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("strategy".equals(fieldName)) { - pollingDetails.strategy = reader.getString(); - } else if ("sync-strategy".equals(fieldName)) { - pollingDetails.syncStrategy = reader.getString(); - } else if ("intermediate-type".equals(fieldName)) { - pollingDetails.intermediateType = reader.getString(); - } else if ("final-type".equals(fieldName)) { - pollingDetails.finalType = reader.getString(); - } else if ("poll-interval".equals(fieldName)) { - pollingDetails.pollInterval = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return pollingDetails; - }); - } - } - - private final Map pollingConfig; - - /** - * Gets the polling configuration for the specified operation. - * - * @param operation The operation name. - * @return The polling configuration for the specified operation, or the default polling configuration if no - * configuration is specified for the operation. - */ - public PollingDetails getPollingConfig(String operation) { - if (pollingConfig == null) { - return null; - } - for (String key : pollingConfig.keySet()) { - if (key.equalsIgnoreCase(operation)) { - return pollingConfig.get(key); - } - } - return pollingConfig.get("default"); - } - - private final boolean annotateGettersAndSettersForSerialization; - - /** - * Whether model getters and setters should be annotated with Jackson JsonGetter and JsonSetter to handle - * serialization. - *

- * For now, Fields will continue to be annotated with JsonProperty to ensure there are no backwards compatibility - * breaking changes. - * - * @return Whether model getters and setters should be annotated to handle serialization. - */ - public boolean isGettersAndSettersAnnotatedForSerialization() { - return annotateGettersAndSettersForSerialization; - } - - private final String defaultHttpExceptionType; - - /** - * Gets the fully-qualified exception type that is used for error HTTP status codes. - * - * @return The fully-qualified exception type. - */ - public String getDefaultHttpExceptionType() { - return defaultHttpExceptionType; - } - - private final boolean useDefaultHttpStatusCodeToExceptionTypeMapping; - - /** - * Whether to use the default error HTTP status code to exception type mapping. - * - * @return Whether to use the default error HTTP status code to exception type mapping. - */ - public boolean isUseDefaultHttpStatusCodeToExceptionTypeMapping() { - return useDefaultHttpStatusCodeToExceptionTypeMapping; - } - - private final Map httpStatusCodeToExceptionTypeMapping; - - /** - * Gets a read-only view of the custom error HTTP status code to exception type mapping. - * - * @return A read-only view of the custom error HTTP status code to exception type mapping. - */ - public Map getHttpStatusCodeToExceptionTypeMapping() { - return httpStatusCodeToExceptionTypeMapping == null - ? null : Collections.unmodifiableMap(httpStatusCodeToExceptionTypeMapping); - } - - private final boolean generateBuilderPerClient; - - /** - * Whether a builder will be generated for each client. - * - * @return Whether a builder will be generated for each client. - */ - public boolean isGenerateBuilderPerClient() { - return generateBuilderPerClient; - } - - private final boolean handlePartialUpdate; - - /** - * Whether partial updates are handled. - * - * @return Whether partial updates are handled. - */ - public boolean isHandlePartialUpdate() { - return handlePartialUpdate; - } - - private final boolean genericResponseTypes; - - /** - * Whether Response, ResponseBase, PagedResponse, or PagedResponseBase will be used directly with generics instead - * of creating a named type that extends one of those type. - * - * @return Whether generic response types are used instead of named types that extend the generic type. - */ - public boolean isGenericResponseTypes() { - return genericResponseTypes; - } - - private final boolean streamStyleSerialization; - - /** - * Whether models will handle serialization themselves using stream-style serialization instead of relying on - * Jackson Databind. - * - * @return Whether models will handle serialization themselves. - */ - public boolean isStreamStyleSerialization() { - return streamStyleSerialization; - } - - private final boolean isInputStreamForBinary; - - /** - * Whether to use InputStream for binary in response body. - * - * @return If true, return InputStream for binary in response body. If false, return - * BinaryData. - */ - public boolean isInputStreamForBinary() { - return isInputStreamForBinary; - } - - private final boolean includeReadOnlyInConstructorArgs; - - /** - * Whether required read-only properties will be included in constructor arguments. - *

- * In the past, required read-only properties were included in constructor arguments when - * {@link #isRequiredFieldsAsConstructorArgs()} was true. This flag re-enables that capability when the property is - * required and read-only and {@link #isRequiredFieldsAsConstructorArgs()} is true. - *

- * If this returns true but {@link #isRequiredFieldsAsConstructorArgs()} returns false this configuration does - * nothing. - * - * @return Whether required read-only properties will be included in constructor arguments. - */ - public boolean isIncludeReadOnlyInConstructorArgs() { - return includeReadOnlyInConstructorArgs; - } - - /** - * Whether to use key credential for authentication. - * - * @return Whether to use key credential for authentication. - */ - public boolean isUseKeyCredential() { - return this.useKeyCredential; - } - - private final boolean nullByteArrayMapsToEmptyArray; - - /** - * Whether {@code ArrayType.BYTE_ARRAY} will return an empty array instead of null when the default value expression - * is null. - *

- * Set this to true to ensure backwards compatibility with previous versions of the Java generator. - * - * @return Whether {@code ArrayType.BYTE_ARRAY} will return an empty array instead of null when the default value - * expression is null. - */ - public boolean isNullByteArrayMapsToEmptyArray() { - return nullByteArrayMapsToEmptyArray; - } - - /** - * Determines whether REST API methods returning typed headers will be generated. - *

- * If set to true, {@link #isNoCustomHeaders()} and {@link #isGenericResponseTypes()} will be ignored as no REST - * APIs returning typed headers will be generated. Meaning overloads without typed headers won't be generated and - * since no methods with typed headers will exist there won't be usage of {@code ResponseBase}, or named subtypes of - * it. - *

- * No matter the value, typed header classes will be generated. This can be useful if a majority of API calls don't - * returned the typed headers at all but there are still cases where it would be useful to have them. Typed header - * classes are simply created with {@code HttpHeaders} from {@code azure-core}. - * - * @return Whether REST APIs including typed headers should be generated. - */ - public boolean isDisableTypedHeadersMethods() { - return disableTypedHeadersMethods; - } - - private final boolean shareJsonSerializableCode; - - /** - * Whether code generation will attempt to share {@code toJson} and {@code fromJson} code generated for - * {@code JsonSerializable} implementing models. - *

- * When this feature is enabled, the code generated for {@code toJson} and {@code fromJson} will attempt to be - * shared across polymorphic types. This will only happen when all polymorphic models in the polymorphic hierarchy - * are in the same package and meet a few criteria, such as no constructor arguments in the {@code fromJson} case. - * The aim of this feature is to reduce the amount of code generated by {@code JsonSerializable}, which will aid in - * testing all cases and should help the JVM determine more quickly when to JIT certain code. - *

- * This feature is still experimental, therefore is disabled by default. In the future this feature will become - * enabled default, and then further out this feature will always be enabled without the ability to be configured. - * - * @return Whether code generation will attempt to share {@code toJson} and {@code fromJson} code generated for - * {@code JsonSerializable} implementing models. - */ - public boolean isShareJsonSerializableCode() { - return shareJsonSerializableCode; - } - - private final boolean android; - - /** - * Whether to generate code for Android. - * - * @return Whether to generate code for Android. - */ - public boolean isAndroid() { - return android; - } - - private static final String DEFAULT_CODE_GENERATION_HEADER = String.join("\n", - "Code generated by Microsoft (R) AutoRest Code Generator %s", - "Changes may cause incorrect behavior and will be lost if the code is regenerated."); - - private static final String DEFAULT_CODE_GENERATION_HEADER_WITHOUT_VERSION = String.join("\n", - "Code generated by Microsoft (R) AutoRest Code Generator.", - "Changes may cause incorrect behavior and will be lost if the code is regenerated."); - - private static final String MICROSOFT_APACHE_LICENSE_HEADER = String.join("\n", - "Copyright (c) Microsoft and contributors. All rights reserved.\n", - "Licensed under the Apache License, Version 2.0 (the \"License\");", - "you may not use this file except in compliance with the License.", - "You may obtain a copy of the License at", - " https://www.apache.org/licenses/LICENSE-2.0\n", - "Unless required by applicable law or agreed to in writing, software", - "distributed under the License is distributed on an \"AS IS\" BASIS,", - "WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n", - "See the License for the specific language governing permissions and", - "limitations under the License.", - ""); - - private static final String MICROSOFT_MIT_LICENSE_HEADER = String.join("\n", - "Copyright (c) Microsoft Corporation. All rights reserved.", - "Licensed under the MIT License. See License.txt in the project root for license information.", - ""); - - private static final String MICROSOFT_MIT_SMALL_LICENSE_HEADER = String.join("\n", - "Copyright (c) Microsoft Corporation. All rights reserved.", - "Licensed under the MIT License.", - ""); - - private static void loadStringSetting(String settingName, Consumer action) { - String settingValue = host.getStringValue(settingName); - if (settingValue != null) { - logger.debug("Option, string, {} : {}", settingName, settingValue); - action.accept(settingValue); - } - } - - private static String getStringValue(NewPlugin host, String settingName) { - return getStringValue(host, settingName, null); - } - - private static String getStringValue(NewPlugin host, String settingName, String defaultValue) { - String ret = host.getStringValue(settingName); - if (ret == null) { - return defaultValue; - } else { - logger.debug("Option, string, {} : {}", settingName, ret); - SIMPLE_JAVA_SETTINGS.put(settingName, ret); - return ret; - } - } - - private static boolean getBooleanValue(NewPlugin host, String settingName, boolean defaultValue) { - Boolean ret = host.getBooleanValue(settingName); - if (ret == null) { - return defaultValue; - } else { - logger.debug("Option, boolean, {} : {}", settingName, ret); - SIMPLE_JAVA_SETTINGS.put(settingName, ret); - return ret; - } - } - - private static void loadStringOrArraySettingAsArray(String settingName, Consumer> action) { - host.getValue(settingName, jsonString -> { - if (jsonString == null) { - return null; - } else if (jsonString.startsWith("[")) { - // Array values will need to be parsed. - try (JsonReader jsonReader = JsonProviders.createReader(jsonString)) { - List settingValueList = jsonReader.readArray(JsonReader::getString); - logger.debug("Option, array, {} : {}", settingName, settingValueList); - action.accept(settingValueList); - } - } else { - // Single values will be returned as the string representation. - logger.debug("Option, string, {} : {}", settingName, jsonString); - action.accept(Collections.singletonList(jsonString)); - } - - return null; - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/NewPlugin.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/NewPlugin.java deleted file mode 100644 index 302057f1ad..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/NewPlugin.java +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.plugin; - -import com.azure.typespec.extension.base.jsonrpc.Connection; -import com.azure.typespec.extension.base.model.Message; -import com.azure.typespec.extension.base.model.MessageChannel; -import com.azure.typespec.extension.base.model.codemodel.AnnotatedPropertyUtils; -import com.azure.typespec.extension.base.model.codemodel.CodeModelCustomConstructor; -import com.azure.json.JsonProviders; -import com.azure.json.JsonReader; -import com.azure.json.ReadValueCallback; -import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.LoaderOptions; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.constructor.Constructor; -import org.yaml.snakeyaml.inspector.TrustedTagInspector; -import org.yaml.snakeyaml.representer.Representer; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.io.UncheckedIOException; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * Represents a plugin that can be run by AutoRest. - */ -public abstract class NewPlugin { - /** - * The Yaml used to serialize and deserialize YAML. - */ - protected final Yaml yamlMapper; - - /** - * The connection to the AutoRest extension. - */ - protected final Connection connection; - - /** - * The name of the plugin. - */ - protected final String pluginName; - - /** - * The session id. - */ - protected final String sessionId; - - /** - * Reads the content of a file. - * - * @param fileName The name of the file. - * @return The content of the file. - */ - public String readFile(String fileName) { - return connection.request("ReadFile", sessionId, fileName); - } - - /** - * Gets the value of a key. - * - * @param The type of the value. - * @param key The key. - * @param converter The converter to convert the value to the desired type. - * @return The value of the key. - */ - public T getValue(String key, ReadValueCallback converter) { - try { - return converter.read(getValueString(key)); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - } - - /** - * Gets the value of a key as a JSON object. - * - * @param key The key. - * @param converter The converter to convert the value to the desired type. - * @return The value of the key. - * @param The type of the value. - */ - public T getValueWithJsonReader(String key, ReadValueCallback converter) { - String valueString = getValueString(key); - if (valueString == null) { - return null; - } - - try (JsonReader jsonReader = JsonProviders.createReader(valueString)) { - return converter.read(jsonReader); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - } - - private String getValueString(String key) { - return connection.request("GetValue", sessionId, key); - } - - /** - * Gets the value of a key. - * - * @param key The key. - * @return The value of the key. - */ - public String getStringValue(String key) { - return getValue(key, json -> json); - } - - /** - * Gets the value of a key. - * - * @param key The key. - * @param defaultValue The default value if the key doesn't have a value. - * @return The value of the key. - */ - public String getStringValue(String key, String defaultValue) { - String ret = getStringValue(key); - return (ret == null) ? defaultValue : ret; - } - - /** - * Gets the value of a key. - * - * @param key The key. - * @return The value of the key. - */ - public Boolean getBooleanValue(String key) { - return getValue(key, - json -> json == null ? null : (!json.equals("0") && !json.equals("false") && !json.isEmpty())); - } - - /** - * Gets the value of a key. - * - * @param key The key. - * @param defaultValue The default value if the key doesn't have a value. - * @return The value of the key. - */ - public boolean getBooleanValue(String key, boolean defaultValue) { - Boolean ret = getBooleanValue(key); - return (ret == null) ? defaultValue : ret; - } - - /** - * Gets the input files. - * - * @return The input files. - */ - public List listInputs() { - return listInputs(null); - } - - /** - * Gets the input files of a specific type. - * - * @param artifactType The type of the input files. - * @return The input files of the specific type. - */ - public List listInputs(String artifactType) { - String jsonResponse = connection.request("ListInputs", sessionId, artifactType); - try (JsonReader jsonReader = JsonProviders.createReader(jsonResponse)) { - return jsonReader.readArray(JsonReader::getString); - } catch (IOException ex) { - throw new UncheckedIOException(ex); - } - } - - /** - * Sends a message to the AutoRest extension. - * - * @param message The message to send. - */ - public void message(Message message) { - connection.notify("Message", sessionId, message); - } - - /** - * Sends a message to the AutoRest extension. - * - * @param channel The channel of the message. - * @param text The text of the message. - * @param error The error of the message. - * @param keys The keys of the message. - */ - public void message(MessageChannel channel, String text, Throwable error, List keys) { - Message message = new Message(); - message.setChannel(channel); - message.setKey(keys); - message.setSource(Collections.emptyList()); - if (error != null) { - text += "\n" + formatThrowableMessage(error); - } - message.setText(text); - message(message); - } - - /** - * Writes the content to a file. - * - * @param fileName The name of the file. - * @param content The content of the file. - * @param sourceMap The source map of the file. - */ - public void writeFile(String fileName, String content, List sourceMap) { - connection.notify("WriteFile", sessionId, fileName, content, sourceMap); - } - - /** - * Writes the content to a file. - * - * @param fileName The name of the file. - * @param content The content of the file. - * @param sourceMap The source map of the file. - * @param artifactType The type of the file. - */ - public void writeFile(String fileName, String content, List sourceMap, String artifactType) { - Message message = new Message(); - message.setChannel(MessageChannel.FILE); - if (sourceMap == null) { - message.setDetails(Map.of("content", content, "type", artifactType, "uri", fileName)); - } else { - message.setDetails( - Map.of("content", content, "type", artifactType, "uri", fileName, "sourceMap", sourceMap)); - } - message.setText(content); - message.setKey(Arrays.asList(artifactType, fileName)); - connection.notify("Message", sessionId, message); - } - - /** - * Protects the files from being overwritten. - * - * @param path The path to the files to protect. - */ - public void protectFiles(String path) { - List items = listInputs(path); - if (items != null && !items.isEmpty()) { - for (String item : items) { - String content = readFile(item); - writeFile(item, content, null, "preserved-files"); - } - } - String contentSingle = readFile(path); - writeFile(path, contentSingle, null, "preserved-files"); - } - - /** - * Gets the configuration file. - * - * @param fileName The name of the configuration file. - * @return The content of the configuration file. - */ - public String getConfigurationFile(String fileName) { - Map configurations = getValueWithJsonReader("configurationFiles", - jsonReader -> jsonReader.readMap(JsonReader::getString)); - - if (configurations != null) { - Iterator it = configurations.keySet().iterator(); - if (it.hasNext()) { - String first = it.next(); - first = first.substring(0, first.lastIndexOf('/')); - for (String configFile : configurations.keySet()) { - if (Objects.equals(configFile, first + "/" + fileName)) { - return configurations.get(configFile); - } - } - } - } - return ""; - } - - /** - * Updates the configuration file. - * - * @param filename The name of the configuration file. - * @param content The content of the configuration file. - */ - public void updateConfigurationFile(String filename, String content) { - Message message = new Message(); - message.setChannel(MessageChannel.CONFIGURATION); - message.setKey(List.of(filename)); - message.setText(content); - connection.notify("Message", sessionId, message); - } - - /** - * Initializes a new instance of the NewPlugin class. - * - * @param connection The connection to the AutoRest extension. - * @param pluginName The name of the plugin. - * @param sessionId The session id. - */ - public NewPlugin(Connection connection, String pluginName, String sessionId) { - this.connection = connection; - this.pluginName = pluginName; - this.sessionId = sessionId; - Representer representer = new Representer(new DumperOptions()); - representer.setPropertyUtils(new AnnotatedPropertyUtils()); - representer.getPropertyUtils().setSkipMissingProperties(true); - LoaderOptions loaderOptions = new LoaderOptions(); - loaderOptions.setCodePointLimit(50 * 1024 * 1024); - loaderOptions.setMaxAliasesForCollections(Integer.MAX_VALUE); - loaderOptions.setNestingDepthLimit(Integer.MAX_VALUE); - loaderOptions.setTagInspector(new TrustedTagInspector()); - Constructor constructor = new CodeModelCustomConstructor(loaderOptions); - yamlMapper = new Yaml(constructor, representer, new DumperOptions(), loaderOptions); - } - - /** - * The method that is called to run the plugin. - * - * @return Whether the plugin ran successfully. - */ - public boolean process() { - try { - JavaSettings.setHost(this); - return processInternal(); - } catch (Throwable t) { - message(MessageChannel.FATAL, "Unhandled error: " + t.getMessage(), t, List.of(getClass().getSimpleName())); - return false; - } - } - - /** - * The method that is called to run the plugin. - * - * @return Whether the plugin ran successfully. - */ - public abstract boolean processInternal(); - - private String formatThrowableMessage(Throwable t) { - StringWriter stringWriter = new StringWriter(); - PrintWriter printWriter = new PrintWriter(stringWriter); - - t.printStackTrace(printWriter); - return stringWriter.toString(); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/PluginLogger.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/PluginLogger.java deleted file mode 100644 index af619e9167..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/PluginLogger.java +++ /dev/null @@ -1,339 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.plugin; - -import com.azure.typespec.extension.base.model.MessageChannel; -import org.slf4j.helpers.FormattingTuple; -import org.slf4j.helpers.MarkerIgnoringBase; -import org.slf4j.helpers.MessageFormatter; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * A logger for AutoRest plugins. - */ -public final class PluginLogger extends MarkerIgnoringBase { - /** - * The AutoRest plugin. - */ - private final NewPlugin plugin; - - /** - * The keys for logging. - */ - private final List keys; - - /** - * Whether tracing is enabled. - */ - private final boolean isTracingEnabled; - - /** - * Whether debugging is enabled. - */ - private final boolean isDebugEnabled; - - /** - * Construct DefaultLogger for the given class. - * - * @param plugin the AutoRest plugin - * @param clazz the class - * @param labels the labels for logging - */ - public PluginLogger(NewPlugin plugin, Class clazz, String... labels) { - this.plugin = plugin; - this.isTracingEnabled = plugin.getBooleanValue("verbose", false); - this.isDebugEnabled = plugin.getBooleanValue("debug", false) || plugin.getBooleanValue("debugger", false); - - this.keys = new ArrayList<>(); - if (clazz != null) { - keys.add(clazz.getSimpleName()); - } - - if (labels != null && labels.length > 0) { - this.keys.addAll(Arrays.asList(labels)); - } - } - - /** - * Construct DefaultLogger for the given class name. - * - * @param plugin the AutoRest plugin - * @param labels the labels for logging - */ - public PluginLogger(NewPlugin plugin, String... labels) { - this(plugin, null, labels); - } - - /** - * {@inheritDoc} - */ - @Override - public String getName() { - return String.join("/", keys); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isTraceEnabled() { - return isTracingEnabled; - } - - /** - * {@inheritDoc} - */ - @Override - public void trace(final String msg) { - logMessageWithFormat(MessageChannel.VERBOSE, msg); - } - - /** - * {@inheritDoc} - */ - @Override - public void trace(final String format, final Object arg1) { - logMessageWithFormat(MessageChannel.VERBOSE, format, arg1); - } - - /** - * {@inheritDoc} - */ - @Override - public void trace(final String format, final Object arg1, final Object arg2) { - logMessageWithFormat(MessageChannel.VERBOSE, format, arg1, arg2); - } - - /** - * {@inheritDoc} - */ - @Override - public void trace(final String format, final Object... arguments) { - logMessageWithFormat(MessageChannel.VERBOSE, format, arguments); - } - - /** - * {@inheritDoc} - */ - @Override - public void trace(final String msg, final Throwable t) { - log(MessageChannel.VERBOSE, msg, t); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isDebugEnabled() { - return isDebugEnabled; - } - - @Override - public void debug(final String msg) { - logMessageWithFormat(MessageChannel.DEBUG, msg); - } - - /** - * {@inheritDoc} - */ - @Override - public void debug(String format, Object arg) { - logMessageWithFormat(MessageChannel.DEBUG, format, arg); - } - - /** - * {@inheritDoc} - */ - @Override - public void debug(final String format, final Object arg1, final Object arg2) { - logMessageWithFormat(MessageChannel.DEBUG, format, arg1, arg2); - } - - /** - * {@inheritDoc} - */ - @Override - public void debug(String format, Object... args) { - logMessageWithFormat(MessageChannel.DEBUG, format, args); - } - - /** - * {@inheritDoc} - */ - @Override - public void debug(final String msg, final Throwable t) { - log(MessageChannel.DEBUG, msg, t); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isInfoEnabled() { - return true; - } - - - /** - * {@inheritDoc} - */ - @Override - public void info(final String msg) { - logMessageWithFormat(MessageChannel.INFORMATION, msg); - } - - /** - * {@inheritDoc} - */ - @Override - public void info(String format, Object arg) { - logMessageWithFormat(MessageChannel.INFORMATION, format, arg); - } - - /** - * {@inheritDoc} - */ - @Override - public void info(final String format, final Object arg1, final Object arg2) { - logMessageWithFormat(MessageChannel.INFORMATION, format, arg1, arg2); - } - - /** - * {@inheritDoc} - */ - @Override - public void info(String format, Object... args) { - logMessageWithFormat(MessageChannel.INFORMATION, format, args); - } - - /** - * {@inheritDoc} - */ - @Override - public void info(final String msg, final Throwable t) { - log(MessageChannel.INFORMATION, msg, t); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isWarnEnabled() { - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(final String msg) { - logMessageWithFormat(MessageChannel.WARNING, msg); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(String format, Object arg) { - logMessageWithFormat(MessageChannel.WARNING, format, arg); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(final String format, final Object arg1, final Object arg2) { - logMessageWithFormat(MessageChannel.WARNING, format, arg1, arg2); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(String format, Object... args) { - logMessageWithFormat(MessageChannel.WARNING, format, args); - } - - /** - * {@inheritDoc} - */ - @Override - public void warn(final String msg, final Throwable t) { - log(MessageChannel.WARNING, msg, t); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isErrorEnabled() { - return true; - } - - /** - * {@inheritDoc} - */ - @Override - public void error(String format, Object arg) { - logMessageWithFormat(MessageChannel.ERROR, format, arg); - } - - /** - * {@inheritDoc} - */ - @Override - public void error(final String msg) { - logMessageWithFormat(MessageChannel.ERROR, msg); - } - - /** - * {@inheritDoc} - */ - @Override - public void error(final String format, final Object arg1, final Object arg2) { - logMessageWithFormat(MessageChannel.ERROR, format, arg1, arg2); - } - - /** - * {@inheritDoc} - */ - @Override - public void error(String format, Object... args) { - logMessageWithFormat(MessageChannel.ERROR, format, args); - } - - /** - * {@inheritDoc} - */ - @Override - public void error(final String msg, final Throwable t) { - log(MessageChannel.ERROR, msg, t); - } - - /** - * Format and write the message according to the {@code MESSAGE_TEMPLATE}. - * - * @param messageChannel The level to log. - * @param format The log message format. - * @param arguments a list of arbitrary arguments taken in by format. - */ - private void logMessageWithFormat(MessageChannel messageChannel, String format, Object... arguments) { - FormattingTuple tp = MessageFormatter.arrayFormat(format, arguments); - log(messageChannel, tp.getMessage(), tp.getThrowable()); - } - - /** - * Format and write the message according to the {@code MESSAGE_TEMPLATE}. - * - * @param messageChannel log level - * @param message The message itself - * @param t The exception whose stack trace should be logged - */ - private void log(MessageChannel messageChannel, String message, Throwable t) { - plugin.message(messageChannel, message, t, keys); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/package-info.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/package-info.java deleted file mode 100644 index c421bd6f08..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/plugin/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * Contains classes for managing AutoRest plugins. - */ -package com.azure.typespec.extension.base.plugin; diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/FileUtils.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/FileUtils.java deleted file mode 100644 index 576c8a7a5a..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/FileUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.typespec.extension.base.util; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -/** - * Utility class for file operations. - */ -public final class FileUtils { - private FileUtils() { - } - - /** - * Creates a temporary directory. - *

- * If the environment setting {@code codegen.java.temp.directory} is set, the directory will be created under the - * specified path. Otherwise, the directory will be created under the system default temporary directory. - *

- * {@link System#getProperty(String)} is checked before {@link System#getenv(String)}. - *

- * If {@code codegen.java.temp.directory} is set to a non-existent path, the directory will be created under the - * system default temporary directory. - * - * @param prefix The prefix string to be used in generating the directory's name; may be {@code null}. - * @return The path to the newly created directory. - * @throws IOException If an I/O error occurs. - */ - public static Path createTempDirectory(String prefix) throws IOException { - String tempDirectory = System.getProperty("codegen.java.temp.directory"); - if (tempDirectory == null) { - tempDirectory = System.getenv("codegen.java.temp.directory"); - } - - if (tempDirectory != null) { - Path tempDirectoryPath = Paths.get(tempDirectory); - if (Files.exists(tempDirectoryPath)) { - return Files.createTempDirectory(tempDirectoryPath, prefix); - } - } - - return Files.createTempDirectory(prefix); - } -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/HttpExceptionType.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/HttpExceptionType.java deleted file mode 100644 index 39fdbb9689..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/HttpExceptionType.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.extension.base.util; - -/** - * Represents exception types for HTTP requests and responses. - */ -public enum HttpExceptionType { - /** - * The exception thrown when failing to authenticate the HTTP request with status code of {@code 4XX}, typically - * {@code 401 Unauthorized}. - * - *

A runtime exception indicating request authorization failure caused by one of the following scenarios:

- *
    - *
  • A client did not send the required authorization credentials to access the requested resource, i.e. - * Authorization HTTP header is missing in the request
  • - *
  • If the request contains the HTTP Authorization header, then the exception indicates that authorization - * has been refused for the credentials contained in the request header.
  • - *
- */ - CLIENT_AUTHENTICATION, - - /** - * The exception thrown when the HTTP request tried to create an already existing resource and received a status - * code {@code 4XX}, typically {@code 412 Conflict}. - */ - RESOURCE_EXISTS, - - /** - * The exception thrown for invalid resource modification with status code of {@code 4XX}, typically - * {@code 409 Conflict}. - */ - RESOURCE_MODIFIED, - - /** - * The exception thrown when receiving an error response with status code {@code 412 response} (for update) or - * {@code 404 Not Found} (for get/post). - */ - RESOURCE_NOT_FOUND, - - /** - * This exception thrown when an HTTP request has reached the maximum number of redirect attempts with a status code - * of {@code 3XX}. - */ - TOO_MANY_REDIRECTS -} diff --git a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/JsonUtils.java b/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/JsonUtils.java deleted file mode 100644 index e24991b4ad..0000000000 --- a/packages/typespec-java/src/azure-typespec-extension/src/main/java/com/azure/typespec/extension/base/util/JsonUtils.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.typespec.extension.base.util; - -import com.azure.json.JsonReader; -import com.azure.json.JsonToken; -import com.azure.json.WriteValueCallback; - -import java.io.IOException; -import java.util.function.Supplier; - -/** - * Utility classes that help simplify repetitive code with {@code azure-json}. - */ -public final class JsonUtils { - /** - * Reads a JSON object from the passed {@code jsonReader} and creates an object of type {@code T} using the passed - * {@code objectCreator}. The {@code callback} is then called for each field in the JSON object to read the field - * value and set it on the object. - * - * @param jsonReader The JSON reader to read the object from. - * @param objectCreator The supplier that creates a new instance of the object. - * @param callback The callback that reads the field value and sets it on the object. - * @return The object created from the JSON object. - * @param The type of object to create. - * @throws IOException If an error occurs while reading the JSON object. - */ - public static T readObject(JsonReader jsonReader, Supplier objectCreator, ReadObjectCallback callback) - throws IOException { - return jsonReader.readObject(reader -> { - T object = objectCreator.get(); - fieldReaderLoop(reader, (fieldName, r) -> callback.read(object, fieldName, r)); - return object; - }); - } - - /** - * Reads a JSON object from the passed {@code jsonReader} and creates an object of type {@code T} using the passed - * {@code objectCreator}. This method will skip the children of each field in the JSON object. - * - * @param jsonReader The JSON reader to read the object from. - * @param objectCreator The supplier that creates a new instance of the object. - * @return The object created from the JSON object. - * @param The type of object to create. - * @throws IOException If an error occurs while reading the JSON object. - */ - public static T readEmptyObject(JsonReader jsonReader, Supplier objectCreator) throws IOException { - return jsonReader.readObject(reader -> { - T object = objectCreator.get(); - fieldReaderLoop(reader, (fieldName, r) -> r.skipChildren()); - return object; - }); - } - - /** - * Callback for reading a JSON object. - * - * @param The type of the object being read. - */ - public interface ReadObjectCallback { - /** - * Reads a field from the JSON object and sets it on the object. - * - * @param object The object to set the field on. - * @param fieldName The name of the field being read. - * @param jsonReader The JSON reader to read the field value from. - * @throws IOException If an error occurs while reading the field value. - */ - void read(T object, String fieldName, JsonReader jsonReader) throws IOException; - } - - /** - * Helper method to iterate over the field of a JSON object. - *

- * This method will reader the passed {@code jsonReader} until the end of the object is reached. For each field it - * will get the field name and iterate the reader to the next token. This method will then pass the field name and - * reader to the {@code fieldConsumer} for it to consume the JSON field as needed for the object being read. - * - * @param jsonReader The JSON reader to read the object from. - * @param fieldConsumer The consumer that will consume the field name and reader for each field in the object. - * @throws IOException If an error occurs while reading the JSON object. - */ - public static void fieldReaderLoop(JsonReader jsonReader, WriteValueCallback fieldConsumer) - throws IOException { - while (jsonReader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = jsonReader.getFieldName(); - jsonReader.nextToken(); - - fieldConsumer.write(fieldName, jsonReader); - } - } - - private JsonUtils() { - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/azure-typespec-fluentgen.iml b/packages/typespec-java/src/azure-typespec-fluentgen/azure-typespec-fluentgen.iml deleted file mode 100644 index 47a309eed7..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/azure-typespec-fluentgen.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/dependency-reduced-pom.xml b/packages/typespec-java/src/azure-typespec-fluentgen/dependency-reduced-pom.xml deleted file mode 100644 index 6e003beb60..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/dependency-reduced-pom.xml +++ /dev/null @@ -1,175 +0,0 @@ - - - - azure-typespec-parent - com.azure.tools - 1.0.0-beta.5 - - 4.0.0 - azure-typespec-fluentgen - 1.0.0-beta.1 - - - local - - - - maven-shade-plugin - - - package - - shade - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.8 - - - prepare-agent - - prepare-agent - - - - post-unit-test - - report - - - ${project.reporting.outputDirectory}/test-coverage - - - - check - - check - - - ${jacoco.skip.coverage.check} - - - BUNDLE - - - LINE - COVEREDRATIO - ${jacoco.min.linecoverage} - - - BRANCH - COVEREDRATIO - ${jacoco.min.branchcoverage} - - - - - - - - - - - - - - - - - - com.azure - azure-core-management - 1.19.3 - test - - - azure-core - com.azure - - - azure-json - com.azure - - - - - org.junit.jupiter - junit-jupiter-engine - 5.13.4 - test - - - junit-platform-engine - org.junit.platform - - - apiguardian-api - org.apiguardian - - - - - org.junit.jupiter - junit-jupiter-api - 5.13.4 - test - - - opentest4j - org.opentest4j - - - junit-platform-commons - org.junit.platform - - - apiguardian-api - org.apiguardian - - - - - org.junit.jupiter - junit-jupiter-params - 5.13.4 - test - - - apiguardian-api - org.apiguardian - - - - - org.mockito - mockito-core - 4.11.0 - test - - - byte-buddy - net.bytebuddy - - - byte-buddy-agent - net.bytebuddy - - - objenesis - org.objenesis - - - - - - com.azure.typespec.fluent.Main - 0.5 - true - false - 0.7 - - diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/pom.xml b/packages/typespec-java/src/azure-typespec-fluentgen/pom.xml deleted file mode 100644 index bb6869879f..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/pom.xml +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - 4.0.0 - - - com.azure.tools - azure-typespec-parent - 1.0.0-beta.1 - ../pom.xml - - - azure-typespec-fluentgen - 1.0.0-beta.1 - - - 0.7 - 0.5 - true - - - false - - com.azure.typespec.fluent.Main - - - - - com.microsoft.typespec - http-client-generator-mgmt - 1.0.0-beta.1 - - - - com.azure - azure-core-management - 1.19.3 - test - - - org.junit.jupiter - junit-jupiter-engine - 5.13.4 - test - - - org.junit.jupiter - junit-jupiter-api - 5.13.4 - test - - - org.junit.jupiter - junit-jupiter-params - 5.13.4 - test - - - org.mockito - mockito-core - 4.11.0 - test - - - - - - local - - - local - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.8 - - - - - - - prepare-agent - - prepare-agent - - - - post-unit-test - - report - - - ${project.reporting.outputDirectory}/test-coverage - - - - check - - check - - - ${jacoco.skip.coverage.check} - - - BUNDLE - - - LINE - COVEREDRATIO - ${jacoco.min.linecoverage} - - - BRANCH - COVEREDRATIO - ${jacoco.min.branchcoverage} - - - - - - - - - - - - - diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/readme.md b/packages/typespec-java/src/azure-typespec-fluentgen/readme.md deleted file mode 100644 index 044c59c3aa..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/readme.md +++ /dev/null @@ -1,81 +0,0 @@ -#### Fluentgen - -```yaml -pass-thru: - - model-deduplicator - - subset-reducer - -use-extension: - "@autorest/modelerfour": "4.26.2" - -pipeline: - # --- extension remodeler --- - - # "Shake the tree", and normalize the model - modelerfour: - input: openapi-document/multi-api/identity # the plugin where we get inputs from - - # allow developer to do transformations on the code model. - modelerfour/new-transform: - input: modelerfour - - fluentgen: - scope: java - input: modelerfour/identity - naming: - override: - eTag: etag - userName: username - metaData: metadata - timeStamp: timestamp - hostName: hostname - webHook: webhook - coolDown: cooldown - resourceregion: resourceRegion - sTag: stag - tagname: tagName - tagvalue: tagValue - output-artifact: java-files - - fluentgen/emitter: - input: fluentgen - scope: scope-fluentgen/emitter - -scope-fluentgen/emitter: - input-artifact: java-files - output-uri-expr: $key - -output-artifact: java-files - -modelerfour: - flatten-models: false - flatten-payloads: false - - additional-checks: true - lenient-model-deduplication: false - remove-empty-child-schemas: false - seal-single-value-enum-by-default: true - - naming: - choiceValue: upper - preserve-uppercase-max-length: 2 - override: - ip: Ip - id: Id - -include-x-ms-examples-original-file: true - -license-header: MICROSOFT_MIT_SMALL -regenerate-pom: true -sync-methods: all -client-side-validations: true -client-logger: true -generate-client-interfaces: true -required-parameter-client-methods: true -client-flattened-annotation-target: none -null-byte-array-maps-to-empty-array: true -graal-vm-config: true -stream-style-serialization: true -use-object-for-unknown: true -enable-sync-stack: true -``` diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/java/com/azure/typespec/fluent/Main.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/main/java/com/azure/typespec/fluent/Main.java deleted file mode 100644 index 40cabf8914..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/java/com/azure/typespec/fluent/Main.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec.fluent; - -import com.microsoft.typespec.http.client.generator.core.extension.jsonrpc.Connection; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; - -public class Main { - - public static void main(String[] args) { - Connection connection = new Connection(System.out, System.in); - connection.dispatch("GetPluginNames", () -> "[\"fluentgen\"]"); - connection.dispatch("Process", (plugin, sessionId) -> new FluentGen(connection, plugin, sessionId).process()); - connection.dispatchNotification("Shutdown", connection::stop); - - // wait for something to do. - connection.waitForAll(); - System.exit(0); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/eclipse-format-azure-sdk-for-java.xml b/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/eclipse-format-azure-sdk-for-java.xml deleted file mode 100644 index 8e5fa985b2..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/eclipse-format-azure-sdk-for-java.xml +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/readme/pom.xml b/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/readme/pom.xml deleted file mode 100644 index f147ab95c9..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/readme/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - azure-typespec-parent - com.azure.tools - 1.0.0-beta.5 - - - com.azure - customization-loader - 1.0.0-beta.1 - 4.0.0 - - - - com.azure.tools - azure-typespec-customization - 1.0.0-beta.11 - - - diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/simplelogger.properties b/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/simplelogger.properties deleted file mode 100644 index 0c43e4d965..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/main/resources/simplelogger.properties +++ /dev/null @@ -1,35 +0,0 @@ -# SLF4J's SimpleLogger configuration file -# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. -org.slf4j.simpleLogger.logFile=System.out - -# Default logging detail level for all instances of SimpleLogger. -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, defaults to "info". -org.slf4j.simpleLogger.defaultLogLevel=warn - -# Logging detail level for a SimpleLogger instance named "xxxxx". -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, the default logging detail level is used. -#org.slf4j.simpleLogger.log.xxxxx= - -# Set to true if you want the current date and time to be included in output messages. -# Default is false, and will output the number of milliseconds elapsed since startup. -#org.slf4j.simpleLogger.showDateTime=false - -# The date and time format to be used in the output messages. -# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. -# If the format is not specified or is invalid, the default format is used. -# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. -#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z - -# Set to true if you want to output the current thread name. -# Defaults to true. -#org.slf4j.simpleLogger.showThreadName=true - -# Set to true if you want the Logger instance name to be included in output messages. -# Defaults to true. -#org.slf4j.simpleLogger.showLogName=true - -# Set to true if you want the last component of the name to be included in output messages. -# Defaults to false. -#org.slf4j.simpleLogger.showShortLogName=false diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/JavaSettingsAccessor.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/JavaSettingsAccessor.java deleted file mode 100644 index 5aa18c2973..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/JavaSettingsAccessor.java +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.core.extension.plugin; - -public class JavaSettingsAccessor { - - public static void setHost(NewPlugin host) { - JavaSettings.setHost(host); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/TestYamlPropertyBean.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/TestYamlPropertyBean.java deleted file mode 100644 index 1da3bbd2da..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/TestYamlPropertyBean.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.core.extension.plugin; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.YamlProperty; - -public class TestYamlPropertyBean { - - private Extensions extensions; - private Boolean propertyToRemap; - - public Extensions getExtensions() { - return extensions; - } - - public void setExtensions(Extensions extensions) { - this.extensions = extensions; - } - - @YamlProperty("property-to-remap") - public Boolean getPropertyToRemap() { - return propertyToRemap; - } - - public void setPropertyToRemap(Boolean propertyToRemap) { - this.propertyToRemap = propertyToRemap; - } - - public static class Extensions { - private Boolean xmsExamples; - - @YamlProperty("x-ms-examples") - public Boolean getXmsExamples() { - return xmsExamples; - } - - public void setXmsExamples(Boolean xmsExamples) { - this.xmsExamples = xmsExamples; - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/YamlPropertyTest.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/YamlPropertyTest.java deleted file mode 100644 index da313d6347..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/core/extension/plugin/YamlPropertyTest.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.core.extension.plugin; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.AnnotatedPropertyUtils; -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModelCustomConstructor; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.LoaderOptions; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.constructor.Constructor; -import org.yaml.snakeyaml.inspector.TrustedTagInspector; -import org.yaml.snakeyaml.representer.Representer; - -public class YamlPropertyTest { - - @Test - public void test() { - - Representer representer = new Representer(new DumperOptions()); - - representer.setPropertyUtils(new AnnotatedPropertyUtils()); - representer.getPropertyUtils().setSkipMissingProperties(true); - - LoaderOptions loaderOptions = new LoaderOptions(); - loaderOptions.setCodePointLimit(50 * 1024 * 1024); - loaderOptions.setMaxAliasesForCollections(Integer.MAX_VALUE); - loaderOptions.setNestingDepthLimit(Integer.MAX_VALUE); - loaderOptions.setTagInspector(new TrustedTagInspector()); - Constructor constructor = new CodeModelCustomConstructor(loaderOptions); - Yaml yamlMapper = new Yaml(constructor, representer, new DumperOptions(), loaderOptions); - - TestYamlPropertyBean bean = yamlMapper.loadAs(getClass().getClassLoader().getResourceAsStream("yaml-property.yaml"), TestYamlPropertyBean.class); - - Assertions.assertTrue(bean.getPropertyToRemap()); - Assertions.assertNotNull(bean.getExtensions()); - Assertions.assertTrue(bean.getExtensions().getXmsExamples()); - } - - -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/BeforeAllTestsExtension.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/BeforeAllTestsExtension.java deleted file mode 100644 index 4be460e4af..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/BeforeAllTestsExtension.java +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt; - -import org.junit.jupiter.api.extension.BeforeAllCallback; -import org.junit.jupiter.api.extension.ExtensionContext; - -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantLock; - -public class BeforeAllTestsExtension implements BeforeAllCallback, ExtensionContext.Store.CloseableResource { - - private static final Lock LOCK = new ReentrantLock(); - private static volatile boolean started = false; - - @Override - public void beforeAll(final ExtensionContext context) throws Exception { - // lock the access so only one Thread has access to it - LOCK.lock(); - try { - if (!started) { - started = true; - // Your "before all tests" startup logic goes here - // The following line registers a callback hook when the root test context is - // shut down - context.getRoot().getStore(ExtensionContext.Namespace.GLOBAL).put("any unique name", this); - - FluentGen fluentgen = new TestUtils.MockFluentGen(); - } - } finally { - // free the access - LOCK.unlock(); - } - } - - @Override - public void close() throws Throwable { - - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/FluentGenAccessor.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/FluentGenAccessor.java deleted file mode 100644 index 2c9f413728..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/FluentGenAccessor.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.FluentMapper; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentClient; -import com.microsoft.typespec.http.client.generator.mgmt.model.javamodel.FluentJavaPackage; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; - -public class FluentGenAccessor { - - private final FluentGen fluentgen; - - public FluentGenAccessor(FluentGen fluentgen) { - this.fluentgen = fluentgen; - } - - public CodeModel handleYaml(String yamlContent) { - return fluentgen.handleYaml(yamlContent); - } - - public Client handleMap(CodeModel codeModel) { - return fluentgen.handleMap(codeModel); - } - - public FluentJavaPackage handleTemplate(Client client) { - return fluentgen.handleTemplate(client); - } - - public FluentClient handleFluentLite(CodeModel codeModel, Client client, FluentJavaPackage javaPackage) { - return fluentgen.handleFluentLite(codeModel, client, javaPackage, null); - } - - public FluentMapper getFluentMapper() { - return fluentgen.getFluentMapper(); - } - - public void clear() { - fluentgen.clear(); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/FluentGenTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/FluentGenTests.java deleted file mode 100644 index 00be2528e2..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/FluentGenTests.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentClient; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentStatic; -import com.microsoft.typespec.http.client.generator.mgmt.model.javamodel.FluentJavaPackage; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -public class FluentGenTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - @Disabled - public void testProcess() { - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-locks.yaml"); - Client client = FluentStatic.getClient(); - FluentJavaPackage javaPackage = fluentgenAccessor.handleTemplate(client); - FluentClient fluentClient = fluentgenAccessor.handleFluentLite(codeModel, client, javaPackage); - } - - @Test - @Disabled - public void testLiveTestGen(){ - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-signalr.yaml"); - Client client = FluentStatic.getClient(); - FluentJavaPackage javaPackage = fluentgenAccessor.handleTemplate(client); - FluentClient fluentClient = fluentgenAccessor.handleFluentLite(codeModel, client, javaPackage); - } - -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/MockJavagen.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/MockJavagen.java deleted file mode 100644 index 5b1b159047..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/MockJavagen.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt; - -import com.microsoft.typespec.http.client.generator.core.extension.model.Message; -import io.clientcore.core.serialization.json.JsonReader; -import io.clientcore.core.utils.IOExceptionCheckedFunction; -import com.microsoft.typespec.http.client.generator.core.Javagen; -import com.microsoft.typespec.http.client.generator.core.extension.jsonrpc.Connection; - -import java.util.HashMap; -import java.util.Map; - -public class MockJavagen extends Javagen { - - private static final Map DEFAULT_SETTINGS = new HashMap<>(); - - public MockJavagen(Connection connection) { - super(connection, "dummy", "dummy"); - instance = this; - } - - @SuppressWarnings("unchecked") - @Override - public T getValue(String key, IOExceptionCheckedFunction converter) { - return (T) DEFAULT_SETTINGS.get(key); - } - - @SuppressWarnings("unchecked") - @Override - public T getValueWithJsonReader(String key, IOExceptionCheckedFunction converter) { - return (T) DEFAULT_SETTINGS.get(key); - } - - @Override - public void message(Message message) { - } -} - diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/TestUtils.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/TestUtils.java deleted file mode 100644 index 28418bd68b..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/TestUtils.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt; - -import com.microsoft.typespec.http.client.generator.core.extension.model.Message; -import com.microsoft.typespec.http.client.generator.core.Javagen; -import com.microsoft.typespec.http.client.generator.core.extension.jsonrpc.Connection; -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.core.extension.plugin.JavaSettingsAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.FluentMapperAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.ResourceParserTests; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentClient; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentStatic; -import com.microsoft.typespec.http.client.generator.mgmt.util.FluentJavaSettings; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaClass; -import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaFile; -import com.microsoft.typespec.http.client.generator.core.template.prototype.MethodTemplate; -import io.clientcore.core.serialization.json.JsonReader; -import io.clientcore.core.utils.IOExceptionCheckedFunction; -import org.junit.jupiter.api.Assertions; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class TestUtils { - - public static class MockConnection extends Connection { - - public MockConnection() { - super(null, null); - } - } - - public static class MockFluentGen extends FluentGen { - - private static final Map DEFAULT_SETTINGS = new HashMap<>(); - static { - DEFAULT_SETTINGS.put("namespace", "com.azure.resourcemanager.mock"); - DEFAULT_SETTINGS.put("fluent", "lite"); - DEFAULT_SETTINGS.put("sync-methods", "all"); - DEFAULT_SETTINGS.put("client-side-validations", true); - DEFAULT_SETTINGS.put("client-logger", true); - DEFAULT_SETTINGS.put("generate-client-interfaces", true); - DEFAULT_SETTINGS.put("required-parameter-client-methods", true); - DEFAULT_SETTINGS.put("generate-samples", true); - DEFAULT_SETTINGS.put("generate-tests", true); - DEFAULT_SETTINGS.put("client-flattened-annotation-target", "NONE"); - DEFAULT_SETTINGS.put("use-object-for-unknown", true); - } - - private Javagen javagen; - - public MockFluentGen() { - super(new MockConnection(), "dummy", "dummy"); - instance = this; - - JavaSettingsAccessor.setHost(this); - - FluentStatic.setFluentJavaSettings(new FluentJavaSettings(this)); - - javagen = new MockJavagen(this.connection); - } - - @SuppressWarnings("unchecked") - @Override - public T getValue(String key, IOExceptionCheckedFunction converter) { - return (T) DEFAULT_SETTINGS.get(key); - } - - @SuppressWarnings("unchecked") - @Override - public T getValueWithJsonReader(String key, IOExceptionCheckedFunction converter) { - return (T) DEFAULT_SETTINGS.get(key); - } - - @Override - public void message(Message message) { -// System.out.println(String.format("[%1$s] %2$s", message.getChannel(), message.getText())); - } - - @Override - public void writeFile(String fileName, String content, List sourceMap) { - } - } - - // autorest --use=. --java --fluent=lite --namespace=com.azure.resourcemanager.locks --input-file=https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/locks/stable/2016-09-01/locks.json - // autorest --use=. --java --fluent=lite --namespace=com.azure.resourcemanager.storage fluent-tests/swagger/readme.storage.md - // autorest --use=. --java --fluent=lite --namespace=com.azure.resourcemanager.policy https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/policy/readme.md --tag=package-policy-2020-09 - // autorest --use=. --java --fluent=lite --namespace=com.azure.resourcemanager.signalr --input-file=https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/SignalRService/stable/2024-03-01/signalr.json - // autorest --use=. --java --fluent=lite --namespace=com.azure.resourcemanager.botservice --input-file=https://github.com/Azure/azure-rest-api-specs/blob/main/specification/botservice/resource-manager/Microsoft.BotService/BotService/preview/2021-05-01-preview/botservice.json - - // cp fluentgen/code-model.yaml fluentgen/src/test/resources/code-model-fluentnamer-###.yaml - - public static CodeModel loadCodeModel(FluentGenAccessor fluentgenAccessor, String filename) { - String searchYamlContent = loadYaml(filename); - - fluentgenAccessor.clear(); - CodeModel codeModel = fluentgenAccessor.handleYaml(searchYamlContent); - Client client = fluentgenAccessor.handleMap(codeModel); - - FluentStatic.setClient(client); - - return codeModel; - } - - public static String loadYaml(String filename) { - try { - Path path = Paths.get(ResourceParserTests.class.getClassLoader().getResource(filename).toURI()); - - return Files.readString(path); - } catch (IOException | URISyntaxException e) { - Assertions.fail(e); - return null; - } - } - - public static class ContentLocks { - private final CodeModel codeModel; - private final Client client; - private final FluentClient fluentClient; - - private final List fluentModels; - - private final FluentResourceModel lockModel; - private final FluentResourceCollection lockCollection; - - public ContentLocks(CodeModel codeModel, Client client, FluentClient fluentClient, - List fluentModels, - FluentResourceModel lockModel, FluentResourceCollection lockCollection) { - this.codeModel = codeModel; - this.client = client; - this.fluentClient = fluentClient; - this.fluentModels = fluentModels; - this.lockModel = lockModel; - this.lockCollection = lockCollection; - } - - public CodeModel getCodeModel() { - return codeModel; - } - - public Client getClient() { - return client; - } - - public FluentClient getFluentClient() { - return fluentClient; - } - - public List getFluentModels() { - return fluentModels; - } - - public FluentResourceModel getLockModel() { - return lockModel; - } - - public FluentResourceCollection getLockCollection() { - return lockCollection; - } - } - - public static ContentLocks initContentLocks(FluentGenAccessor fluentgenAccessor) { - CodeModel codeModel = loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-locks.yaml"); - Client client = FluentStatic.getClient(); - FluentClient fluentClient = new FluentMapperAccessor(fluentgenAccessor.getFluentMapper()).basicMap(codeModel, client); - - List fluentModels = fluentClient.getResourceModels(); - List fluentCollections = fluentClient.getResourceCollections(); - - FluentResourceModel lockModel = fluentModels.stream() - .filter(m -> m.getName().equals("ManagementLockObject")) - .findFirst().get(); - - FluentResourceCollection lockCollection = fluentCollections.stream() - .filter(c -> c.getInnerGroupClient().getClassBaseName().startsWith("ManagementLocks")) - .findFirst().get(); - - return new ContentLocks(codeModel, client, fluentClient, fluentModels, lockModel, lockCollection); - } - - public static String getMethodTemplateContent(MethodTemplate methodTemplate) { - JavaFile javaFile = new JavaFile("dummy"); - methodTemplate.writeMethod(new JavaClass(javaFile.getContents())); - return javaFile.getContents().toString(); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/checker/JavaFormatterTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/checker/JavaFormatterTests.java deleted file mode 100644 index 38bbd01a18..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/checker/JavaFormatterTests.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.checker; - -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import org.junit.jupiter.api.BeforeAll; - -public class JavaFormatterTests { - - private final String JAVA_CONTENT = "package com.azure.typespec.fluent.checker;\n" + - "\n" + - "import com.azure.typespec.extension.base.plugin.PluginLogger;\n" + - "import com.azure.typespec.fluent.FluentGen;\n" + - "import com.azure.core.util.CoreUtils;\n" + - "import org.slf4j.Logger;\n" + - "\n" + - "import java.lang.reflect.Method;\n" + - "import java.util.ArrayList;\n" + - "import java.util.Collections;\n" + - "import java.util.List;\n" + - "import java.util.regex.Pattern;\n" + - "\n" + - "public class JavaFormatter {\n" + - " private final String content;\n" + - " private final String path;\n" + - "\n" + - " public JavaFormatter(String content, String path) {\n" + - " this.content = content;\n" + - " this.path = path;\n" + - " String longString = \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines/{virtualmachineIndex}/networkInterfaces/{networkInterfaceName}/ipconfigurations/{ipConfigurationName}/publicipaddresses/{publicIpAddressName}\";\n" + - " }\n" + - "}\n"; - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - -// @EnabledForJreRange(min = JRE.JAVA_11, max = JRE.JAVA_20) -// @Test -// public void testFormatter() { -// JavaFormatter formatter = new JavaFormatter(JAVA_CONTENT, "mock"); -// String content = formatter.format(); -// String[] lines = content.split("\r?\n", -1); -// Assertions.assertTrue(Arrays.stream(lines).noneMatch(s -> s.equals("import com.azure.typespec.extension.base.plugin.PluginLogger;"))); -// } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMapperAccessor.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMapperAccessor.java deleted file mode 100644 index 2abb22ba56..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMapperAccessor.java +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.mapper; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentClient; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; - -public class FluentMapperAccessor { - - private final FluentMapper fluentMapper; - - public FluentMapperAccessor(FluentMapper fluentMapper) { - this.fluentMapper = fluentMapper; - } - - public FluentClient basicMap(CodeModel codeModel, Client client) { - return fluentMapper.basicMap(codeModel, client); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMethodGroupMapperTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMethodGroupMapperTests.java deleted file mode 100644 index 2179cc7f33..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentMethodGroupMapperTests.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.mapper; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.OperationGroup; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.model.FluentType; -import com.microsoft.typespec.http.client.generator.mgmt.util.Utils; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClassType; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.IType; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.MethodGroupClient; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.List; -import java.util.Optional; - -public class FluentMethodGroupMapperTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testSupportedInterfaces() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - CodeModel codeModel = content.getCodeModel(); - Client client = content.getClient(); - - OperationGroup operationGroup = codeModel.getOperationGroups().stream() - .filter(og -> Utils.getDefaultName(og).equals("ManagementLocks")) - .findFirst().get(); - - Optional clientOpt = client.getServiceClient().getMethodGroupClients().stream() - .filter(mgc -> mgc.getClassBaseName().equals("ManagementLocks")) - .findFirst(); - Assertions.assertTrue(clientOpt.isPresent()); - - List supportedInterfaces = FluentMethodGroupMapper.getInstance().findSupportedInterfaces(operationGroup, clientOpt.get().getClientMethods()); - Assertions.assertEquals(3, supportedInterfaces.size()); - Assertions.assertTrue(supportedInterfaces.stream().anyMatch(t -> t.toString().contains(FluentType.innerSupportsGet(ClassType.OBJECT).getName()))); - Assertions.assertTrue(supportedInterfaces.stream().anyMatch(t -> t.toString().contains(FluentType.innerSupportsList(ClassType.OBJECT).getName()))); - Assertions.assertTrue(supportedInterfaces.stream().anyMatch(t -> t.toString().contains(FluentType.innerSupportsDelete(ClassType.OBJECT).getName()))); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentPomMapperTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentPomMapperTests.java deleted file mode 100644 index f258a8e427..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/FluentPomMapperTests.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.mapper; - -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Pom; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.model.projectmodel.FluentProject; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import java.util.List; - -public class FluentPomMapperTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testMergeDependencies() { - String additionalDependencyIdentifier = "com.azure.resourcemanager:azure-resourcemanager-resources:2.42.0:test"; - - FluentProject fluentProject = Mockito.mock(FluentProject.class); - Mockito.when(fluentProject.getGroupId()).thenReturn("com.azure.resourcemanager"); - Mockito.when(fluentProject.getArtifactId()).thenReturn("azure-resourcemanager-mock"); - Mockito.when(fluentProject.getVersion()).thenReturn("1.0.0-beta.1"); - Mockito.when(fluentProject.getServiceName()).thenReturn("MockManagement"); - Mockito.when(fluentProject.getServiceDescription()).thenReturn("MockManagement"); - Mockito.when(fluentProject.getServiceDescriptionForPom()).thenReturn("MockManagement"); - Mockito.when(fluentProject.getPomDependencyIdentifiers()).thenReturn(List.of(additionalDependencyIdentifier)); - - Pom pom = new FluentPomMapper().map(fluentProject); - - Assertions.assertTrue(pom.getDependencyIdentifiers().stream().anyMatch(p -> p.equals(additionalDependencyIdentifier))); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/ResourceParserAccessor.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/ResourceParserAccessor.java deleted file mode 100644 index e7e25491bd..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/ResourceParserAccessor.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.mapper; - -import com.microsoft.typespec.http.client.generator.mgmt.model.arm.ModelCategory; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.action.ResourceActions; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.ResourceCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.delete.ResourceDelete; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.get.ResourceRefresh; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.update.ResourceUpdate; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientModel; - -import java.util.List; -import java.util.Optional; - -public class ResourceParserAccessor { - - public static List resolveResourceCreate( - FluentResourceCollection collection, - List availableFluentModels, - List availableModels) { - return ResourceParser.resolveResourceCreate(collection, availableFluentModels, availableModels); - } - - public static List resolveResourceCreate( - FluentResourceCollection collection, - List availableFluentModels, - List availableModels, - List categories) { - return ResourceParser.resolveResourceCreate(collection, availableFluentModels, availableModels, categories); - } - - public static Optional resolveResourceUpdate( - FluentResourceCollection collection, - ResourceCreate resourceCreate, - List availableModels) { - return ResourceParser.resolveResourceUpdate(collection, resourceCreate, availableModels); - } - - static Optional resolveResourceRefresh( - FluentResourceCollection collection, - ResourceCreate resourceCreate) { - return ResourceParser.resolveResourceRefresh(collection, resourceCreate); - } - - public static Optional resolveResourceDelete( - FluentResourceCollection collection, - ResourceCreate resourceCreate) { - return ResourceParser.resolveResourceDelete(collection, resourceCreate); - } - - public static Optional resourceResourceActions( - FluentResourceCollection collection, - ResourceCreate resourceCreate) { - return ResourceParser.resourceResourceActions(collection, resourceCreate); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/ResourceParserTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/ResourceParserTests.java deleted file mode 100644 index 517524417e..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/mapper/ResourceParserTests.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.mapper; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.model.arm.ModelCategory; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentCollectionMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentStatic; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.ResourceCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.delete.ResourceDelete; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.get.ResourceRefresh; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.update.ResourceUpdate; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import io.clientcore.core.http.models.HttpMethod; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.function.Function; -import java.util.stream.Collectors; - -public class ResourceParserTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testResourceCreate() { - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-locks.yaml"); - Client client = FluentStatic.getClient(); - - List fluentModels = - codeModel.getSchemas().getObjects().stream() - .map(o -> FluentResourceModelMapper.getInstance().map(o)) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - List fluentCollections = - codeModel.getOperationGroups().stream() - .map(og -> FluentResourceCollectionMapper.getInstance().map(og)) - .filter(Objects::nonNull) - .collect(Collectors.toList()); - - FluentResourceModel lockModel = fluentModels.stream() - .filter(m -> m.getName().equals("ManagementLockObject")) - .findFirst().get(); - - FluentResourceCollection lockCollection = fluentCollections.stream() - .filter(c -> c.getInnerGroupClient().getClassBaseName().startsWith("ManagementLocks")) - .findFirst().get(); - - // test findResourceCreateForCategory - { - Map fluentModelMapByName = fluentModels.stream() - .collect(Collectors.toMap(m -> m.getInterfaceType().toString(), Function.identity())); - - // RESOURCE_GROUP_AS_PARENT - Map resourceCreateMap = - ResourceParser.findResourceCreateForCategory(lockCollection, fluentModelMapByName, client.getModels(), Collections.emptySet(), ModelCategory.RESOURCE_GROUP_AS_PARENT); - - Assertions.assertEquals(1, resourceCreateMap.size()); - ResourceCreate resourceCreate = resourceCreateMap.values().iterator().next(); - - Assertions.assertEquals("createOrUpdateAtResourceGroupLevel", resourceCreate.getMethodName()); - Assertions.assertTrue(resourceCreate.getUrlPathSegments().hasSubscription()); - Assertions.assertTrue(resourceCreate.getUrlPathSegments().hasResourceGroup()); - Assertions.assertFalse(resourceCreate.getUrlPathSegments().isNested()); - - // SCOPE_AS_PARENT - resourceCreateMap = - ResourceParser.findResourceCreateForCategory(lockCollection, fluentModelMapByName, client.getModels(), Collections.emptySet(), ModelCategory.SCOPE_AS_PARENT); - - Assertions.assertEquals(1, resourceCreateMap.size()); - resourceCreate = resourceCreateMap.values().iterator().next(); - - Assertions.assertEquals("createOrUpdateByScope", resourceCreate.getMethodName()); - Assertions.assertTrue(resourceCreate.getUrlPathSegments().hasScope()); - Assertions.assertFalse(resourceCreate.getUrlPathSegments().isNested()); - - // SUBSCRIPTION_AS_PARENT - resourceCreateMap = - ResourceParser.findResourceCreateForCategory(lockCollection, fluentModelMapByName, client.getModels(), Collections.emptySet(), ModelCategory.SUBSCRIPTION_AS_PARENT); - - Assertions.assertEquals(1, resourceCreateMap.size()); - resourceCreate = resourceCreateMap.values().iterator().next(); - - Assertions.assertEquals("createOrUpdateAtSubscriptionLevel", resourceCreate.getMethodName()); - - // NESTED_CHILD, not available in locks - resourceCreateMap = - ResourceParser.findResourceCreateForCategory(lockCollection, fluentModelMapByName, client.getModels(), Collections.emptySet(), ModelCategory.NESTED_CHILD); - - Assertions.assertTrue(resourceCreateMap.isEmpty()); - } - - // test resolveResourceCreate - List resourceCreates = ResourceParser.resolveResourceCreate(lockCollection, fluentModels, client.getModels()); - Assertions.assertEquals(1, resourceCreates.size()); - - ResourceCreate lockCreate = resourceCreates.iterator().next(); - - Assertions.assertEquals(lockCollection, lockCreate.getResourceCollection()); - Assertions.assertEquals(lockModel, lockCreate.getResourceModel()); - Assertions.assertEquals(ModelCategory.RESOURCE_GROUP_AS_PARENT, lockCreate.getResourceModel().getCategory()); - - Assertions.assertEquals(1, lockCollection.getResourceCreates().size()); - Assertions.assertEquals(lockCreate, lockCollection.getResourceCreates().iterator().next()); - - Assertions.assertEquals(lockCreate, lockModel.getResourceCreate()); - - List methodReferences = lockCreate.getMethodReferences(); - Assertions.assertEquals(2, methodReferences.size()); - Assertions.assertTrue(methodReferences.iterator().next().getMethodName().startsWith("createOrUpdateAtResourceGroupLevel")); - Assertions.assertEquals(lockCreate.getUrlPathSegments().getPath(), methodReferences.iterator().next().getInnerProxyMethod().getUrlPath()); - Assertions.assertEquals(HttpMethod.PUT, methodReferences.iterator().next().getInnerProxyMethod().getHttpMethod()); - - // test resolveResourceUpdate - ResourceUpdate lockUpdate = ResourceParser.resolveResourceUpdate(lockCollection, lockCreate, client.getModels()).get(); - methodReferences = lockUpdate.getMethodReferences(); - Assertions.assertEquals(2, methodReferences.size()); - Assertions.assertTrue(methodReferences.iterator().next().getMethodName().startsWith("createOrUpdateAtResourceGroupLevel")); - Assertions.assertEquals(lockCreate.getUrlPathSegments().getPath(), methodReferences.iterator().next().getInnerProxyMethod().getUrlPath()); - Assertions.assertEquals(HttpMethod.PUT, methodReferences.iterator().next().getInnerProxyMethod().getHttpMethod()); - - // test resolveResourceRefresh - ResourceRefresh lockRefresh = ResourceParser.resolveResourceRefresh(lockCollection, lockCreate).get(); - methodReferences = lockRefresh.getMethodReferences(); - Assertions.assertEquals(2, methodReferences.size()); - Assertions.assertTrue(methodReferences.iterator().next().getMethodName().startsWith("getByResourceGroup")); - Assertions.assertEquals(lockCreate.getUrlPathSegments().getPath(), methodReferences.iterator().next().getInnerProxyMethod().getUrlPath()); - Assertions.assertEquals(HttpMethod.GET, methodReferences.iterator().next().getInnerProxyMethod().getHttpMethod()); - - // test resolveResourceRefresh - ResourceDelete lockDelete = ResourceParser.resolveResourceDelete(lockCollection, lockCreate).get(); - methodReferences = lockDelete.getMethodReferences(); - Assertions.assertEquals(2, methodReferences.size()); - Assertions.assertTrue(methodReferences.iterator().next().getMethodName().startsWith("deleteByResourceGroup")); - Assertions.assertEquals(lockCreate.getUrlPathSegments().getPath(), methodReferences.iterator().next().getInnerProxyMethod().getUrlPath()); - Assertions.assertEquals(HttpMethod.DELETE, methodReferences.iterator().next().getInnerProxyMethod().getHttpMethod()); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/arm/UrlPathSegmentsTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/arm/UrlPathSegmentsTests.java deleted file mode 100644 index 01c9723bb2..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/arm/UrlPathSegmentsTests.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.arm; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -public class UrlPathSegmentsTests { - - @Test - public void testUrlPathSegments() { - UrlPathSegments segments = new UrlPathSegments("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"); - - Assertions.assertTrue(segments.hasSubscription()); - Assertions.assertTrue(segments.hasResourceGroup()); - Assertions.assertFalse(segments.hasScope()); - Assertions.assertFalse(segments.isNested()); - - segments = new UrlPathSegments("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}"); - - Assertions.assertTrue(segments.hasSubscription()); - Assertions.assertTrue(segments.hasResourceGroup()); - Assertions.assertFalse(segments.hasScope()); - Assertions.assertTrue(segments.isNested()); - Assertions.assertEquals(4, segments.getReverseParameterSegments().size()); - Assertions.assertEquals("containers", segments.getReverseParameterSegments().get(0).getSegmentName()); - Assertions.assertEquals("storageAccounts", segments.getReverseParameterSegments().get(1).getSegmentName()); - Assertions.assertEquals("resourceGroups", segments.getReverseParameterSegments().get(2).getSegmentName()); - Assertions.assertEquals("subscriptions", segments.getReverseParameterSegments().get(3).getSegmentName()); - - segments = new UrlPathSegments("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}"); - - Assertions.assertTrue(segments.hasSubscription()); - Assertions.assertFalse(segments.hasResourceGroup()); - Assertions.assertFalse(segments.hasScope()); - Assertions.assertFalse(segments.isNested()); - - segments = new UrlPathSegments("/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"); - - Assertions.assertFalse(segments.hasSubscription()); - Assertions.assertFalse(segments.hasResourceGroup()); - Assertions.assertTrue(segments.hasScope()); - Assertions.assertFalse(segments.isNested()); - - segments = new UrlPathSegments("/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}"); - - Assertions.assertFalse(segments.hasSubscription()); - Assertions.assertFalse(segments.hasResourceGroup()); - Assertions.assertTrue(segments.hasScope()); - Assertions.assertTrue(segments.isNested()); - Assertions.assertEquals(3, segments.getReverseParameterSegments().size()); - Assertions.assertEquals("suppressions", segments.getReverseParameterSegments().get(0).getSegmentName()); - Assertions.assertEquals("recommendations", segments.getReverseParameterSegments().get(1).getSegmentName()); - Assertions.assertEquals("", segments.getReverseParameterSegments().get(2).getSegmentName()); - - segments = new UrlPathSegments("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}"); - - Assertions.assertTrue(segments.hasSubscription()); - Assertions.assertTrue(segments.hasResourceGroup()); - Assertions.assertFalse(segments.hasScope()); - Assertions.assertEquals(6, segments.getReverseParameterSegments().size()); - Assertions.assertEquals("", segments.getReverseParameterSegments().get(0).getSegmentName()); - Assertions.assertEquals("", segments.getReverseParameterSegments().get(1).getSegmentName()); - Assertions.assertEquals("", segments.getReverseParameterSegments().get(2).getSegmentName()); - Assertions.assertEquals("providers", segments.getReverseParameterSegments().get(3).getSegmentName()); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/ProxyMethodExampleTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/ProxyMethodExampleTests.java deleted file mode 100644 index 10532b9764..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/ProxyMethodExampleTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel; - -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ProxyMethodExample; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -public class ProxyMethodExampleTests { - - @BeforeAll - public static void ensurePlugin() { - new TestUtils.MockFluentGen(); - } - - @Test - public void testRelativeOriginalFileName() { - ProxyMethodExample example = new ProxyMethodExample.Builder() - .originalFile("file:///c:/github/azure-rest-api-specs/specification/resources/resource-manager/Microsoft.Resources/stable/2019-08-01/examples/PutDeploymentAtScope.json") - .build(); - Assertions.assertEquals("specification/resources/resource-manager/Microsoft.Resources/stable/2019-08-01/examples/PutDeploymentAtScope.json", example.getRelativeOriginalFileName()); - - example = new ProxyMethodExample.Builder() - .originalFile("https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getDataPolicyManifest.json") - .build(); - Assertions.assertEquals("specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getDataPolicyManifest.json", example.getRelativeOriginalFileName()); - - // not able to parse - example = new ProxyMethodExample.Builder() - .originalFile("/c:/github/azure-rest-api-specs/specification/resources/resource-manager/Microsoft.Resources/stable/2019-08-01/examples/PutDeploymentAtScope.json") - .build(); - Assertions.assertEquals(example.getOriginalFile(), example.getRelativeOriginalFileName()); - } - - @Test - public void testUnescapeQueryValue() { - String queryNotEscaped1 = "timestamp ge datetime'2017-06-01T00:00:00' and timestamp le datetime'2017-06-04T00:00:00'"; - String queryNotEscaped2 = "properties/extensionHandler/any(eh: eh/version gt '2.70') and contains(name,'sql') and contains(properties/nodeConfiguration/name,'$$Not$$Configured$$')"; - - String queryNotEscaped3 = "properties/eventDate ge 2020-05-20 AND properties/eventDate le 2020-05-30"; - String queryEscaped3 = "properties/eventDate+ge+2020-05-20+AND+properties/eventDate+le+2020-05-30"; - - String queryNotEscaped4 = "(properties/archived eq false)"; - String queryEscaped4 = "(properties%2farchived+eq+false)"; - - String queryNotEscaped5 = "status eq 'Active' and severity eq 'Critical'"; - String queryEscaped5 = "status%20eq%20'Active'%20and%20severity%20eq%20'Critical'"; - - ProxyMethodExample.ParameterValue parameterValue = new ProxyMethodExample.ParameterValue(queryNotEscaped1); - Assertions.assertEquals(queryNotEscaped1, parameterValue.getUnescapedQueryValue().toString()); - - parameterValue = new ProxyMethodExample.ParameterValue(queryNotEscaped2); - Assertions.assertEquals(queryNotEscaped2, parameterValue.getUnescapedQueryValue().toString()); - - parameterValue = new ProxyMethodExample.ParameterValue(queryEscaped3); - Assertions.assertEquals(queryNotEscaped3, parameterValue.getUnescapedQueryValue().toString()); - - parameterValue = new ProxyMethodExample.ParameterValue(queryEscaped4); - Assertions.assertEquals(queryNotEscaped4, parameterValue.getUnescapedQueryValue().toString()); - - parameterValue = new ProxyMethodExample.ParameterValue(queryEscaped5); - Assertions.assertEquals(queryNotEscaped5, parameterValue.getUnescapedQueryValue().toString()); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/FluentMethodTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/FluentMethodTests.java deleted file mode 100644 index ddabf0e9a8..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/FluentMethodTests.java +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.RequestParameterLocation; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.FluentMapperAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.ResourceParserAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.model.arm.ModelCategory; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentClient; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentCollectionMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentStatic; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.action.ResourceActions; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.DefinitionStageCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.DefinitionStageMisc; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.ResourceCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.delete.ResourceDelete; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentConstructorByInner; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentConstructorByName; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentDefineMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentMethodParameterMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentMethodType; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.update.ResourceUpdate; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClassType; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientMethodParameter; -import com.microsoft.typespec.http.client.generator.core.template.prototype.MethodTemplate; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -public class FluentMethodTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testConstructorAndMethods() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - Client client = content.getClient(); - FluentResourceModel lockModel = content.getLockModel(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - List resourceCreates = ResourceParserAccessor.resolveResourceCreate(lockCollection, content.getFluentModels(), client.getModels()); - ResourceCreate lockCreate = resourceCreates.iterator().next(); - ResourceUpdate lockUpdate = ResourceParserAccessor.resolveResourceUpdate(lockCollection, lockCreate, client.getModels()).get(); - - // constructor by inner - FluentMethod constructor = new FluentConstructorByInner(lockModel, FluentMethodType.CONSTRUCTOR, - lockUpdate.getPathParameters(), lockUpdate.getResourceLocalVariables(), - FluentStatic.getFluentManager().getType(), lockUpdate.getUrlPathSegments()); - - Assertions.assertEquals("ManagementLockObjectImpl(ManagementLockObjectInner innerObject, com.azure.resourcemanager.mock.ManagementLockManager serviceManager)", constructor.getImplementationMethodSignature()); - - String methodContent = TestUtils.getMethodTemplateContent(constructor.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("this.innerObject = innerObject;")); - Assertions.assertTrue(methodContent.contains("this.serviceManager = serviceManager;")); - Assertions.assertTrue(methodContent.contains("this.lockName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), \"locks\")")); - - // constructor by name - constructor = new FluentConstructorByName(lockModel, FluentMethodType.CONSTRUCTOR, - ClassType.STRING, "lockName", - FluentStatic.getFluentManager().getType(), lockCreate.getResourceLocalVariables()); - - Assertions.assertEquals("ManagementLockObjectImpl(String name, com.azure.resourcemanager.mock.ManagementLockManager serviceManager)", constructor.getImplementationMethodSignature()); - - methodContent = TestUtils.getMethodTemplateContent(constructor.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("new ManagementLockObjectInner();")); - Assertions.assertTrue(methodContent.contains("this.serviceManager = serviceManager;")); - Assertions.assertTrue(methodContent.contains("this.lockName = name;")); - - // this constructor without name (when name is constant) is not valid for Locks - constructor = FluentConstructorByName.constructorMethodWithConstantResourceName(lockModel, FluentMethodType.CONSTRUCTOR, - FluentStatic.getFluentManager().getType(), lockCreate.getResourceLocalVariables()); - - Assertions.assertEquals("ManagementLockObjectImpl(com.azure.resourcemanager.mock.ManagementLockManager serviceManager)", constructor.getImplementationMethodSignature()); - - methodContent = TestUtils.getMethodTemplateContent(constructor.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("new ManagementLockObjectInner();")); - Assertions.assertTrue(methodContent.contains("this.serviceManager = serviceManager;")); - Assertions.assertFalse(methodContent.contains("this.lockName = name;")); - - // update() - FluentMethod updateMethod = lockUpdate.getUpdateMethod(); - Assertions.assertEquals("ManagementLockObject.Update update()", updateMethod.getInterfaceMethodSignature()); - - methodContent = TestUtils.getMethodTemplateContent(updateMethod.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("return this")); - - // apply() - List applyMethods = lockUpdate.getApplyMethods(); - Assertions.assertEquals(2, applyMethods.size()); - - FluentMethod applyMethod = applyMethods.iterator().next(); - Assertions.assertEquals("ManagementLockObject apply()", applyMethod.getInterfaceMethodSignature()); - - methodContent = TestUtils.getMethodTemplateContent(applyMethod.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("createOrUpdateAtResourceGroupLevelWithResponse(resourceGroupName, lockName, this.innerModel(), Context.NONE)")); - - // define(..) - FluentDefineMethod defineMethod = lockCreate.getDefineMethod(); - - Assertions.assertEquals("ManagementLockObject.DefinitionStages.Blank defineAtResourceGroupLevel(String name)", defineMethod.getInterfaceMethodSignature()); - - methodContent = TestUtils.getMethodTemplateContent(defineMethod.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("new ManagementLockObjectImpl(name, this.manager())")); - } - - @Test - public void testOperationById() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - Client client = content.getClient(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - List resourceCreates = ResourceParserAccessor.resolveResourceCreate(lockCollection, content.getFluentModels(), client.getModels()); - ResourceCreate lockCreate = resourceCreates.iterator().next(); - ResourceDelete lockDelete = ResourceParserAccessor.resolveResourceDelete(lockCollection, lockCreate).get(); - - List deleteByIdMethods = lockDelete.getDeleteByIdCollectionMethods(); - Assertions.assertEquals(2, deleteByIdMethods.size()); - - MethodTemplate deleteByIdMethod = deleteByIdMethods.iterator().next(); - String methodContent = TestUtils.getMethodTemplateContent(deleteByIdMethod); - - Assertions.assertTrue(methodContent.contains("void deleteById(String id)")); - Assertions.assertTrue(methodContent.contains("this.deleteByResourceGroupWithResponse(resourceGroupName, lockName, Context.NONE)")); - } - - @Test - public void testOperationByIdForScope() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - Client client = content.getClient(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - Map fluentModelMapByName = content.getFluentModels().stream() - .collect(Collectors.toMap(m -> m.getInterfaceType().toString(), Function.identity())); - - // SCOPE_AS_PARENT - List resourceCreates = ResourceParserAccessor.resolveResourceCreate(lockCollection, content.getFluentModels(), client.getModels(), Collections.singletonList(ModelCategory.SCOPE_AS_PARENT)); - ResourceCreate lockCreate = resourceCreates.iterator().next(); - ResourceDelete lockDelete = ResourceParserAccessor.resolveResourceDelete(lockCollection, lockCreate).get(); - - List deleteByIdMethods = lockDelete.getDeleteByIdCollectionMethods(); - Assertions.assertEquals(2, deleteByIdMethods.size()); - - MethodTemplate deleteByIdMethod = deleteByIdMethods.iterator().next(); - String methodContent = TestUtils.getMethodTemplateContent(deleteByIdMethod); - - Assertions.assertTrue(methodContent.contains("void deleteById(String id)")); - Assertions.assertTrue(methodContent.contains("this.deleteByScopeWithResponse(scope, lockName, Context.NONE)")); - } - - @Test - public void testActionMethod() { - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-storage.yaml"); - Client client = FluentStatic.getClient(); - FluentClient fluentClient = new FluentMapperAccessor(fluentgenAccessor.getFluentMapper()).basicMap(codeModel, client); - - List fluentModels = fluentClient.getResourceModels(); - List fluentCollections = fluentClient.getResourceCollections(); - - FluentResourceCollection blobContainerCollection = fluentCollections.stream() - .filter(c -> c.getInnerGroupClient().getClassBaseName().startsWith("BlobContainer")) - .findFirst().get(); - - List resourceCreates = ResourceParserAccessor.resolveResourceCreate(blobContainerCollection, fluentModels, client.getModels()); - ResourceCreate blobContainerCreate = resourceCreates.iterator().next(); - ResourceActions lockActions = ResourceParserAccessor.resourceResourceActions(blobContainerCollection, blobContainerCreate).get(); - - List actionMethods = lockActions.getFluentMethods(); - Assertions.assertEquals(6, actionMethods.size()); - - FluentMethod leaseMethod = actionMethods.stream() - .filter(m -> m.getName().equals("lease")) - .findFirst().get(); - String methodContent = TestUtils.getMethodTemplateContent(leaseMethod.getMethodTemplate()); - - Assertions.assertTrue(methodContent.contains("LeaseContainerResponse lease()")); - Assertions.assertTrue(methodContent.contains("serviceManager.blobContainers().lease(resourceGroupName, accountName, containerName)")); - } - - @Test - public void testParameterMethod() { - // the "lockName" parameter is not valid as FluentMethodParameterMethod for Locks - - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - FluentResourceModel lockModel = content.getLockModel(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - FluentCollectionMethod method = lockCollection.getMethods().stream() - .filter(m -> m.getMethodName().equals("createOrUpdateAtResourceGroupLevel")) - .findFirst().get(); - ClientMethodParameter lockParameter = method.getInnerClientMethod().getParameters().stream() - .filter(p -> p.getName().equals("lockName")) - .findFirst().get(); - - DefinitionStageMisc stage = new DefinitionStageMisc("WithLockName", lockParameter); - DefinitionStageCreate nextStage = new DefinitionStageCreate(); - stage.setNextStage(nextStage); - - LocalVariable variable = new LocalVariable("lockName", ClassType.STRING, RequestParameterLocation.PATH, lockParameter); - - FluentMethodParameterMethod parameterMethod = new FluentMethodParameterMethod(lockModel, FluentMethodType.CREATE_WITH, stage, lockParameter, variable); - Assertions.assertEquals("WithCreate withLockName(String lockName)", parameterMethod.getInterfaceMethodSignature()); - - parameterMethod = new FluentMethodParameterMethod(lockModel, FluentMethodType.CREATE_WITH, stage, lockParameter, variable, "withLockNameParameter"); - Assertions.assertEquals("WithCreate withLockNameParameter(String lockName)", parameterMethod.getInterfaceMethodSignature()); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceCreateTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceCreateTests.java deleted file mode 100644 index 6fe1fab02a..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceCreateTests.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel; - -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.ResourceParserAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.DefinitionStage; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.DefinitionStageBlank; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.DefinitionStageCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.DefinitionStageParent; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.ResourceCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentMethod; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.List; - -public class ResourceCreateTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testDefinitionStages() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - Client client = content.getClient(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - List resourceCreates = ResourceParserAccessor.resolveResourceCreate(lockCollection, content.getFluentModels(), client.getModels()); - ResourceCreate lockCreate = resourceCreates.iterator().next(); - - List definitionStages = lockCreate.getDefinitionStages(); - Assertions.assertEquals(6, definitionStages.size()); - - DefinitionStageBlank blankStage = (DefinitionStageBlank) definitionStages.get(0); - DefinitionStageParent parentStage = (DefinitionStageParent) definitionStages.get(1); - DefinitionStage levelStage = definitionStages.get(2); - DefinitionStageCreate createStage = (DefinitionStageCreate) definitionStages.get(3); - DefinitionStage optionalNotesStage = definitionStages.get(4); - DefinitionStage optionalOwnersStage = definitionStages.get(5); - - Assertions.assertEquals("Blank", blankStage.getName()); - Assertions.assertEquals("WithResourceGroup", blankStage.getExtendStages()); - Assertions.assertEquals(parentStage, blankStage.getNextStage()); - Assertions.assertEquals(0, blankStage.getMethods().size()); - - Assertions.assertEquals("WithResourceGroup", parentStage.getName()); - Assertions.assertNull(parentStage.getExtendStages()); - Assertions.assertEquals(levelStage, parentStage.getNextStage()); - Assertions.assertEquals(1, parentStage.getMethods().size()); - - Assertions.assertEquals("WithLevel", levelStage.getName()); - Assertions.assertNull(levelStage.getExtendStages()); - Assertions.assertEquals(createStage, levelStage.getNextStage()); - Assertions.assertNotNull(levelStage.getModelProperty()); - Assertions.assertEquals(1, levelStage.getMethods().size()); - Assertions.assertEquals("level", levelStage.getModelProperty().getName()); - - Assertions.assertEquals("WithCreate", createStage.getName()); - Assertions.assertEquals("DefinitionStages.WithNotes, DefinitionStages.WithOwners", createStage.getExtendStages()); - Assertions.assertNull(createStage.getNextStage()); - Assertions.assertEquals(2, createStage.getMethods().size()); - - Assertions.assertEquals("WithNotes", optionalNotesStage.getName()); - Assertions.assertNull(optionalNotesStage.getExtendStages()); - Assertions.assertEquals(createStage, optionalNotesStage.getNextStage()); - - Assertions.assertEquals("WithOwners", optionalOwnersStage.getName()); - Assertions.assertNull(optionalOwnersStage.getExtendStages()); - Assertions.assertEquals(createStage, optionalOwnersStage.getNextStage()); - - FluentMethod createMethod = createStage.getMethods().iterator().next(); - String methodContent = TestUtils.getMethodTemplateContent(createMethod.getMethodTemplate()); - - Assertions.assertTrue(methodContent.contains("ManagementLockObject create()")); - Assertions.assertTrue(methodContent.contains("serviceManager.serviceClient().getManagementLocks().createOrUpdateAtResourceGroupLevelWithResponse(resourceGroupName, lockName, this.innerModel(), Context.NONE)")); - - FluentMethod parentMethod = parentStage.getMethods().iterator().next(); - methodContent = TestUtils.getMethodTemplateContent(parentMethod.getMethodTemplate()); - - Assertions.assertTrue(methodContent.contains("ManagementLockObjectImpl withExistingResourceGroup(String resourceGroupName)")); - Assertions.assertTrue(methodContent.contains("this.resourceGroupName = resourceGroupName")); - - FluentMethod propertyMethod = levelStage.getMethods().iterator().next(); - methodContent = TestUtils.getMethodTemplateContent(propertyMethod.getMethodTemplate()); - - Assertions.assertTrue(methodContent.contains("ManagementLockObjectImpl withLevel(LockLevel level)")); - Assertions.assertTrue(methodContent.contains("this.innerModel().withLevel(level)")); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceImplementationTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceImplementationTests.java deleted file mode 100644 index 3a7d248d31..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceImplementationTests.java +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel; - -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.ResourceParserAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.ResourceCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentApplyMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentConstructorByName; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentCreateMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentParentMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.method.FluentUpdateMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.immutablemodel.ImmutableMethod; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.List; - -public class ResourceImplementationTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testImplementation() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - Client client = content.getClient(); - FluentResourceModel lockModel = content.getLockModel(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - List resourceCreates = ResourceParserAccessor.resolveResourceCreate(lockCollection, content.getFluentModels(), client.getModels()); - ResourceCreate lockCreate = resourceCreates.iterator().next(); - ResourceParserAccessor.resolveResourceUpdate(lockCollection, lockCreate, client.getModels()); - - ResourceImplementation implementation = new ResourceImplementation(lockModel); - - List methods = implementation.getMethods(); - Assertions.assertEquals(11, methods.size()); - Assertions.assertTrue(methods.stream().anyMatch(m -> m instanceof FluentParentMethod)); - Assertions.assertTrue(methods.stream().anyMatch(m -> m instanceof FluentCreateMethod)); - Assertions.assertTrue(methods.stream().anyMatch(m -> m instanceof FluentConstructorByName)); - Assertions.assertTrue(methods.stream().anyMatch(m -> m instanceof FluentUpdateMethod)); - Assertions.assertTrue(methods.stream().anyMatch(m -> m instanceof FluentApplyMethod)); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceUpdateTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceUpdateTests.java deleted file mode 100644 index 61d71bd4e9..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/fluentmodel/ResourceUpdateTests.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel; - -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.mapper.ResourceParserAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.create.ResourceCreate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.update.ResourceUpdate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.fluentmodel.update.UpdateStage; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.List; - -public class ResourceUpdateTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testUpdateStages() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - Client client = content.getClient(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - List resourceCreates = ResourceParserAccessor.resolveResourceCreate(lockCollection, content.getFluentModels(), client.getModels()); - ResourceCreate lockCreate = resourceCreates.iterator().next(); - ResourceUpdate resourceUpdate = ResourceParserAccessor.resolveResourceUpdate(lockCollection, lockCreate, client.getModels()).get(); - - List updateStages = resourceUpdate.getUpdateStages(); - Assertions.assertEquals(3, updateStages.size()); - - updateStages.stream().forEach(stage -> { - Assertions.assertNotNull(stage.getNextStage()); - Assertions.assertEquals("Update", stage.getNextStage().getName()); - Assertions.assertEquals(1, stage.getMethods().size()); - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/immutablemethod/MethodTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/immutablemethod/MethodTests.java deleted file mode 100644 index 91ca06797f..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/clientmodel/immutablemethod/MethodTests.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.immutablemethod; - -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentCollectionMethod; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceCollection; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentResourceModel; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.immutablemodel.CollectionMethodTemplate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.immutablemodel.CollectionMethodTypeConversionTemplate; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.immutablemodel.PropertyTemplate; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -public class MethodTests { - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testMethods() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - FluentResourceModel lockModel = content.getLockModel(); - FluentResourceCollection lockCollection = content.getLockCollection(); - - // model property, without type conversion - PropertyTemplate propertyTemplate = new PropertyTemplate(lockModel.getProperty("owners"), lockModel.getProperty("owners").getModelProperty()); - String methodContent = TestUtils.getMethodTemplateContent(propertyTemplate.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("List inner = this.innerModel().owners()")); - - propertyTemplate = new PropertyTemplate(lockModel.getProperty("notes"), lockModel.getProperty("notes").getModelProperty()); - methodContent = TestUtils.getMethodTemplateContent(propertyTemplate.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("return this.innerModel().notes()")); - - // collection method, with type conversion - FluentCollectionMethod method = lockCollection.getMethods().stream().filter(m -> m.getMethodName().equals("createOrUpdateAtResourceGroupLevel")).findFirst().get(); - CollectionMethodTypeConversionTemplate collectionMethodTypeConversionTemplate = new CollectionMethodTypeConversionTemplate(method, method.getInnerClientMethod().getReturnValue().getType()); - - methodContent = TestUtils.getMethodTemplateContent(collectionMethodTypeConversionTemplate.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("ManagementLockObjectInner inner = this.serviceClient().createOrUpdateAtResourceGroupLevel(resourceGroupName, lockName, parameters)")); - Assertions.assertTrue(methodContent.contains("return new ManagementLockObjectImpl(inner, this.manager())")); - - // collection method, without type conversion - method = content.getFluentClient().getResourceCollections().stream().filter(c -> c.getInnerGroupClient().getClassBaseName().equals("AuthorizationOperations")).findFirst().get() - .getMethods().stream().filter(m -> m.getMethodName().equals("list")).findFirst().get(); - CollectionMethodTemplate collectionMethodTemplate = new CollectionMethodTemplate(method, method.getInnerClientMethod().getReturnValue().getType()); - - methodContent = TestUtils.getMethodTemplateContent(collectionMethodTemplate.getMethodTemplate()); - Assertions.assertTrue(methodContent.contains("return this.serviceClient().list()")); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/projectmodel/ChangelogTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/projectmodel/ChangelogTests.java deleted file mode 100644 index 4119778ab3..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/projectmodel/ChangelogTests.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.projectmodel; - -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -public class ChangelogTests { - - private static final String CHANGELOG_LINE = "Provides operations for working with resources and resource groups. Package tag package-resources-2020-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt)."; - - private static class MockProject extends FluentProject { - - public MockProject() { - super("Resource", null, null); - } - - @Override - public String getServiceDescriptionForMarkdown() { - return CHANGELOG_LINE; - } - - @Override - public String getVersion() { - return "1.1.0-beta.1"; - } - } - - @BeforeAll - public static void ensurePlugin() { - new TestUtils.MockFluentGen(); - } - - @Test - public void testChangelog() { - FluentProject mockProject = new MockProject(); - String dateUtc = Changelog.getDateUtc(); - - { - Changelog changelog = new Changelog(mockProject); - Assertions.assertTrue(changelog.getLines().contains(String.format("## 1.1.0-beta.1 (%s)", dateUtc))); - Assertions.assertTrue(changelog.getLines().stream().anyMatch(l -> l.equals("- Azure Resource Manager Resource client library for Java. " + CHANGELOG_LINE))); - } - - { - String existingChangelog = - "# Release History\n" + - "\n" + - "## 1.0.1-beta.1 (Unreleased)\n" + - "\n" + - "- Added test cases.\n" + - "- Azure Resource Manager Resource client library for Java. This package contains Microsoft Azure SDK for Resource Management SDK. Provides operations for working with resources and resource groups. Package tag package-resources-2020-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt)." + - "\n" + - "## 1.0.0 (2020-10-29)\n" + - "\n" + - "- Initial release."; - - Changelog changelog = new Changelog(existingChangelog); - changelog.updateForVersion(mockProject); - - Assertions.assertTrue(changelog.getLines().contains(String.format("## 1.1.0-beta.1 (%s)", dateUtc))); - Assertions.assertTrue(changelog.getLines().contains("## 1.0.0 (2020-10-29)")); - - Assertions.assertFalse(changelog.getLines().contains("## 1.0.1-beta.1 (Unreleased)")); - - int previousChangelog = changelog.getLines().indexOf("- Added test cases."); - int addedChangelog = changelog.getLines().indexOf("- Azure Resource Manager Resource client library for Java. " + CHANGELOG_LINE); - Assertions.assertTrue(previousChangelog > 0); - Assertions.assertTrue(addedChangelog > 0); - Assertions.assertEquals(previousChangelog - 1, addedChangelog); - - Assertions.assertTrue(changelog.getLines().contains("- Initial release.")); - } - - { - String existingChangelog = - "# Release History\n" + - "\n" + - "## 1.0.0 (2020-10-29)\n" + - "\n" + - "- Initial release."; - - Changelog changelog = new Changelog(existingChangelog); - changelog.updateForVersion(mockProject); - - Assertions.assertTrue(changelog.getLines().contains(String.format("## 1.1.0-beta.1 (%s)", dateUtc))); - Assertions.assertTrue(changelog.getLines().contains("## 1.0.0 (2020-10-29)")); - - Assertions.assertTrue(changelog.getLines().contains("- Initial release.")); - } - - { - String existingChangelog = - "# Release History\n" + - "\n" + - "## 1.1.0-beta.1 (2020-11-20)\n" + - "\n" + - "- Unreleased changes.\n" + - "\n" + - "## 1.0.0 (2020-10-29)\n" + - "\n" + - "- Initial release."; - - Changelog changelog = new Changelog(existingChangelog); - changelog.updateForVersion(mockProject); - - Assertions.assertTrue(changelog.getLines().contains(String.format("## 1.1.0-beta.1 (%s)", dateUtc))); - Assertions.assertTrue(changelog.getLines().contains("## 1.0.0 (2020-10-29)")); - - Assertions.assertFalse(changelog.getLines().contains("## 1.1.0-beta.1 (2020-11-20)")); - - Assertions.assertTrue(changelog.getLines().contains("- Unreleased changes.")); - Assertions.assertTrue(changelog.getLines().contains("- Initial release.")); - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/projectmodel/ProjectTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/projectmodel/ProjectTests.java deleted file mode 100644 index 28fdbbb884..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/model/projectmodel/ProjectTests.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.model.projectmodel; - -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentClient; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.Optional; - -public class ProjectTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testFluentProject() { - TestUtils.ContentLocks content = TestUtils.initContentLocks(fluentgenAccessor); - FluentClient fluentClient = content.getFluentClient(); - - FluentProject project = new FluentProject(fluentClient, null); - Assertions.assertEquals("com.azure.resourcemanager", project.getGroupId()); - Assertions.assertEquals("azure-resourcemanager-mock", project.getArtifactId()); - Assertions.assertNotNull(project.getChangelog()); - - // ignore for IO - project.integrateWithSdk(); - - Optional coreMgmtVer = FluentProject.checkArtifact("com.azure:azure-core-management;1.1.0;1.2.0-beta.1", "com.azure:azure-core-management", false); - Assertions.assertTrue(coreMgmtVer.isPresent()); - Assertions.assertEquals("1.1.0", coreMgmtVer.get()); - - coreMgmtVer = FluentProject.checkArtifact("com.azure:azure-core-management;1.1.0;1.2.0-beta.1", "com.azure:azure-core-management", true); - Assertions.assertTrue(coreMgmtVer.isPresent()); - Assertions.assertEquals("1.2.0-beta.1", coreMgmtVer.get()); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/ClientMethodTemplateTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/ClientMethodTemplateTests.java deleted file mode 100644 index 870028acfc..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/ClientMethodTemplateTests.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.template; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaClass; -import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaFile; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentStatic; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientMethod; -import com.microsoft.typespec.http.client.generator.core.template.ClientMethodTemplate; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import java.util.List; -import java.util.NoSuchElementException; -import java.util.Optional; -import java.util.stream.Stream; - -public class ClientMethodTemplateTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @ParameterizedTest - @MethodSource("clientMethodTemplateSupplier") - public void testClientMethodTemplate(List lockMethodGroupClientMethods, String methodName, - String includeString) { - Optional clientMethod = lockMethodGroupClientMethods.stream() - .filter(m -> m.getName().equals(methodName)) - .findFirst(); - Assertions.assertTrue(clientMethod.isPresent()); - - if (includeString != null) { - ClientMethodTemplate template = FluentClientMethodTemplate.getInstance(); - JavaFile javaFile = new JavaFile("dummy"); - template.write(clientMethod.get(), new JavaClass(javaFile.getContents())); - String content = javaFile.getContents().toString(); - Assertions.assertTrue(content.contains(includeString), - String.format("Expected content not found: '%s'\nMethod content:\n%s", includeString, content)); - } - } - - static Stream clientMethodTemplateSupplier() { - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-locks.yaml"); - Client client = FluentStatic.getClient(); - - List lockMethodGroupClientMethods = client.getServiceClient().getMethodGroupClients() - .stream() - .filter(c -> c.getClassBaseName().startsWith("ManagementLocks")) - .findFirst() - .orElseThrow(() -> new NoSuchElementException("Unable to find class 'ManagementLocks'.")) - .getClientMethods(); - - return Stream.of( - Arguments.of(lockMethodGroupClientMethods, "listByScopeAsync", - "private PagedFlux listByScopeAsync(String scope"), - - Arguments.of(lockMethodGroupClientMethods, "listByScope", - "public PagedIterable listByScope(String scope"), - - Arguments.of(lockMethodGroupClientMethods, "listByScopeSinglePageAsync", null), - - Arguments.of(lockMethodGroupClientMethods, "listByScopeNextSinglePageAsync", null), - - Arguments.of(lockMethodGroupClientMethods, "createOrUpdateByScopeWithResponseAsync", - "private Mono> createOrUpdateByScopeWithResponseAsync(String scope"), - - Arguments.of(lockMethodGroupClientMethods, "createOrUpdateByScopeWithResponse", - "public Response createOrUpdateByScopeWithResponse(String scope"), - - Arguments.of(lockMethodGroupClientMethods, "createOrUpdateByScopeAsync", - "private Mono createOrUpdateByScopeAsync(String scope"), - - Arguments.of(lockMethodGroupClientMethods, "createOrUpdateByScope", - "public ManagementLockObjectInner createOrUpdateByScope(String scope") - ); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/FluentExampleTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/FluentExampleTests.java deleted file mode 100644 index dff7269584..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/FluentExampleTests.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.template; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGen; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentClient; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentExample; -import com.microsoft.typespec.http.client.generator.mgmt.model.clientmodel.FluentStatic; -import com.microsoft.typespec.http.client.generator.mgmt.model.javamodel.FluentJavaPackage; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import com.microsoft.typespec.http.client.generator.core.model.javamodel.JavaFile; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.List; - -public class FluentExampleTests { - - private static FluentGenAccessor fluentgenAccessor; - - @BeforeAll - public static void ensurePlugin() { - FluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentgenAccessor = new FluentGenAccessor(fluentgen); - } - - @Test - public void testLocks() { - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-locks.yaml"); - Client client = FluentStatic.getClient(); - FluentJavaPackage javaPackage = fluentgenAccessor.handleTemplate(client); - FluentClient fluentClient = fluentgenAccessor.handleFluentLite(codeModel, client, javaPackage); - - List examples = fluentClient.getExamples(); - Assertions.assertFalse(examples.isEmpty()); - // TODO verification - } - - @Test - public void testStorage() { - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-storage.yaml"); - Client client = FluentStatic.getClient(); - FluentJavaPackage javaPackage = fluentgenAccessor.handleTemplate(client); - FluentClient fluentClient = fluentgenAccessor.handleFluentLite(codeModel, client, javaPackage); - - List examples = fluentClient.getExamples(); - Assertions.assertFalse(examples.isEmpty()); - - { - FluentExample example = examples.stream() - .filter(e -> e.getClassName().equals("StorageAccountsCreateSamples")) - .findFirst().get(); - JavaFile javaFile = new JavaFile("dummy"); - FluentExampleTemplate.getInstance().write(example, javaFile); - String content = javaFile.getContents().toString(); - // Map - Assertions.assertTrue(content.contains(".withTags(mapOf(\"key1\",")); - // identity - Assertions.assertTrue(content.contains(".withIdentity(new Identity().withType(IdentityType.USER_ASSIGNED).withUserAssignedIdentities(mapOf(\"/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}\", new UserAssignedIdentity())))")); - // create - Assertions.assertTrue(content.contains(".create()")); - } - - { - FluentExample example = examples.stream() - .filter(e -> e.getClassName().equals("BlobContainersCreateOrUpdateImmutabilityPolicySamples")) - .findFirst().get(); - JavaFile javaFile = new JavaFile("dummy"); - FluentExampleTemplate.getInstance().write(example, javaFile); - String content = javaFile.getContents().toString(); - // optional property/parameter not provided in example - Assertions.assertFalse(content.contains(".withIfMatch")); - // create - Assertions.assertTrue(content.contains(".create()")); - } - - { - FluentExample example = examples.stream() - .filter(e -> e.getClassName().equals("StorageAccountsUpdateSamples")) - .findFirst().get(); - JavaFile javaFile = new JavaFile("dummy"); - FluentExampleTemplate.getInstance().write(example, javaFile); - String content = javaFile.getContents().toString(); - // get - Assertions.assertTrue(content.contains("manager.storageAccounts().getByResourceGroup")); - // update - Assertions.assertTrue(content.contains("resource.update()")); - // apply - Assertions.assertTrue(content.contains(".apply()")); - } - } - - @Test - public void testPolicy() { - CodeModel codeModel = TestUtils.loadCodeModel(fluentgenAccessor, "code-model-fluentnamer-policy.yaml"); - Client client = FluentStatic.getClient(); - FluentJavaPackage javaPackage = fluentgenAccessor.handleTemplate(client); - FluentClient fluentClient = fluentgenAccessor.handleFluentLite(codeModel, client, javaPackage); - - List examples = fluentClient.getExamples(); - Assertions.assertFalse(examples.isEmpty()); - - { - FluentExample example = examples.stream() - .filter(e -> e.getClassName().equals("PolicyDefinitionsCreateOrUpdateAtManagementGroupSamples")) - .findFirst().get(); - JavaFile javaFile = new JavaFile("dummy"); - FluentExampleTemplate.getInstance().write(example, javaFile); - String content = javaFile.getContents().toString(); - // policyRule and metadata is Object - Assertions.assertTrue(content.contains(".withMetadata(SerializerFactory.createDefaultManagementSerializerAdapter().deserialize(\"{\\\"category\\\":\\\"Naming\\\"}\", Object.class, SerializerEncoding.JSON))")); - } - - { - FluentExample example = examples.stream() - .filter(e -> e.getClassName().equals("PolicyDefinitionsCreateOrUpdateSamples")) - .findFirst().get(); - JavaFile javaFile = new JavaFile("dummy"); - FluentExampleTemplate.getInstance().write(example, javaFile); - String content = javaFile.getContents().toString(); - // allowedValues is array of Object - Assertions.assertTrue(content.contains(".withAllowedValues(Arrays.asList(0, 30, 90, 180, 365))")); - Assertions.assertTrue(content.contains(".withDefaultValue(365)")); - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/ModelTemplateTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/ModelTemplateTests.java deleted file mode 100644 index fbd357d14b..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/template/ModelTemplateTests.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - - -package com.microsoft.typespec.http.client.generator.mgmt.template; - -import com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel; -import com.microsoft.typespec.http.client.generator.core.extension.plugin.JavaSettings; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.Client; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientModel; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientModelPropertyAccess; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClientModelPropertyReference; -import com.microsoft.typespec.http.client.generator.mgmt.FluentGenAccessor; -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.core.mapper.ClientMapper; -import com.azure.core.util.CoreUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.List; - -public class ModelTemplateTests { - - private final JavaSettings settings = JavaSettings.getInstance(); - private static FluentGenAccessor fluentGenAccessor; - - @BeforeAll - public static void init(){ - TestUtils.MockFluentGen fluentgen = new TestUtils.MockFluentGen(); - fluentGenAccessor = new FluentGenAccessor(fluentgen); - } - - /** - * Issue: https://github.com/Azure/autorest.java/issues/1320 - * Remove duplicate setter methods from child schema when parent schema contains same property - * mainly to test {@link com.microsoft.typespec.http.client.generator.core.template.ModelTemplate#getSuperSetters(ClientModel, JavaSettings, List)} - */ - @Test - public void deduplicateTest(){ - CodeModel codeModel = TestUtils.loadCodeModel(fluentGenAccessor, "code-model-fluentnamer-botservice.yaml"); - Client client = ClientMapper.getInstance().map(codeModel); - ClientModel model = client.getModels().stream().filter(clientModel -> clientModel.getName().equals("Site")).findAny().get(); - ModelTemplateAccessor templateAccessor = new ModelTemplateAccessor(); - List propertyReferences = templateAccessor.getClientModelPropertyReferences0(model); - if (!CoreUtils.isNullOrEmpty(model.getPropertyReferences())) { - propertyReferences.addAll(model.getPropertyReferences()); - } - // real test here - List toOverride = templateAccessor.getSuperSetters(model, settings, propertyReferences); - Assertions.assertEquals(toOverride.size(), 1); - } - - private static class ModelTemplateAccessor extends FluentModelTemplate { - - public List getClientModelPropertyReferences0(ClientModel model) { - return super.getClientModelPropertyReferences(model); - } - - public List getSuperSetters(ClientModel model, JavaSettings settings, List propertyReferences) { - return super.getSuperSetters(model, settings, propertyReferences); - } - - } - - -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/FluentUtilsTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/FluentUtilsTests.java deleted file mode 100644 index 81dab671b4..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/FluentUtilsTests.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.util; - -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.core.util.CodeNamer; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.Arrays; -import java.util.Collections; - -public class FluentUtilsTests { - - @BeforeAll - public static void ensurePlugin() { - new TestUtils.MockFluentGen(); - } - - @Test - public void testGetServiceName() { - final String packageName = "com.azure.resourcemanager.appservice.generated"; - - Assertions.assertEquals("Web", FluentUtils.getServiceNameFromClientName("WebManagementClient", packageName)); - - Assertions.assertEquals("ResourceGraph", FluentUtils.getServiceNameFromClientName("ResourceGraphClient", packageName)); - - Assertions.assertEquals("Appservice", CodeNamer.toPascalCase(FluentUtils.getServiceNameFromClientName("Web", packageName))); - } - - @Test - public void testGetArtifactId() { - Assertions.assertEquals("azure-resourcemanager-appservice-generated", FluentUtils.getArtifactIdFromPackageName("com.azure.resourcemanager.appservice.generated")); - - Assertions.assertEquals("azure-resourcemanager-appservice", FluentUtils.getArtifactIdFromPackageName("com.azure.resourcemanager.appservice")); - } - - @Test - public void testSplitFlattenedSerializedName() { - Assertions.assertEquals(Collections.singletonList("odata.properties"), FluentUtils.splitFlattenedSerializedName("odata.properties".replace(".", "\\\\."))); - - Assertions.assertEquals(Arrays.asList("properties", "virtualNetworkSubnetId"), FluentUtils.splitFlattenedSerializedName("properties.virtualNetworkSubnetId")); - - Assertions.assertEquals(Arrays.asList("odata.properties", "virtualNetworkSubnetId"), FluentUtils.splitFlattenedSerializedName("odata.properties".replace(".", "\\\\.") + ".virtualNetworkSubnetId")); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/GeneratedUtilsClassWorkbenchTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/GeneratedUtilsClassWorkbenchTests.java deleted file mode 100644 index 1efc1f656d..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/GeneratedUtilsClassWorkbenchTests.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.util; - -import com.azure.core.util.CoreUtils; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -public class GeneratedUtilsClassWorkbenchTests { - - static final class Utils { - static String getValueFromIdByName(String id, String name) { - if (id == null) { - return null; - } - Iterator itr = Arrays.stream(id.split("/")).iterator(); - while (itr.hasNext()) { - String part = itr.next(); - if (part != null && !part.trim().isEmpty()) { - if (part.equalsIgnoreCase(name)) { - if (itr.hasNext()) { - return itr.next(); - } else { - return null; - } - } - } - } - return null; - } - - static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { - if (id == null || pathTemplate == null) { - return null; - } - String parameterNameParentheses = "{" + parameterName + "}"; - List idSegmentsReverted = Arrays.asList(id.split("/")); - List pathSegments = Arrays.asList(pathTemplate.split("/")); - Collections.reverse(idSegmentsReverted); - Iterator idItrReverted = idSegmentsReverted.iterator(); - int pathIndex = pathSegments.size(); - while (idItrReverted.hasNext() && pathIndex > 0) { - String idSegment = idItrReverted.next(); - String pathSegment = pathSegments.get(--pathIndex); - if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { - if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { - if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { - List segments = new ArrayList<>(); - segments.add(idSegment); - idItrReverted.forEachRemaining(segments::add); - Collections.reverse(segments); - if (segments.size() > 0 && segments.get(0).isEmpty()) { - segments.remove(0); - } - return String.join("/", segments); - } else { - return idSegment; - } - } - } - } - return null; - } - } - - @Test - public void testGetValueFromIdByName() { - String id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-weidxu/providers/Microsoft.ServiceBus/namespaces/sb1weidxu/queues/queue1"; - - Assertions.assertEquals("00000000-0000-0000-0000-000000000000", Utils.getValueFromIdByName(id, "subscriptions")); - Assertions.assertEquals("rg-weidxu", Utils.getValueFromIdByName(id, "ResourceGroups")); - Assertions.assertEquals("Microsoft.ServiceBus", Utils.getValueFromIdByName(id, "providers")); - Assertions.assertEquals("sb1weidxu", Utils.getValueFromIdByName(id, "namespaces")); - Assertions.assertEquals("queue1", Utils.getValueFromIdByName(id, "queues")); - - Assertions.assertNull(Utils.getValueFromIdByName(id, "notExist")); - } - - @Test void testGetValuesFromId() { - String pathTemplate = "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}"; - String id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-weidxu/providers/Microsoft.Authorization/roleAssignments/00000000-0000-0000-0000-000000000001"; - - Assertions.assertEquals("00000000-0000-0000-0000-000000000001", Utils.getValueFromIdByParameterName(id, pathTemplate, "roleAssignmentName")); - Assertions.assertEquals("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-weidxu", Utils.getValueFromIdByParameterName(id, pathTemplate, "scope")); - - pathTemplate = "/{resourceUri}/providers/Microsoft.Advisor/recommendations/{recommendationId}/suppressions/{name}"; - id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-weidxu/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Advisor/recommendations/recommendation1/suppressions/suppressionName1"; - - Assertions.assertEquals("recommendation1", Utils.getValueFromIdByParameterName(id, pathTemplate, "recommendationId")); - Assertions.assertEquals("suppressionName1", Utils.getValueFromIdByParameterName(id, pathTemplate, "name")); - Assertions.assertEquals("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-weidxu/providers/Microsoft.Compute/virtualMachines/vm1", Utils.getValueFromIdByParameterName(id, pathTemplate, "resourceUri")); - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/RetryOptionsTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/RetryOptionsTests.java deleted file mode 100644 index 71af4b7e3f..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/RetryOptionsTests.java +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.util; - -import com.azure.core.http.HttpHeaderName; -import com.azure.core.http.policy.ExponentialBackoff; -import com.azure.core.http.policy.ExponentialBackoffOptions; -import com.azure.core.http.policy.FixedDelay; -import com.azure.core.http.policy.FixedDelayOptions; -import com.azure.core.http.policy.RetryOptions; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.RetryStrategy; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.lang.reflect.Field; -import java.time.Duration; -import java.time.temporal.ChronoUnit; -import java.util.Objects; - -public class RetryOptionsTests { - - public static class Configurable { - // see Manager_Configurable.txt - - private RetryPolicy retryPolicy; - private RetryOptions retryOptions; - - /** - * Sets the retry policy to the HTTP pipeline. - * - * @param retryPolicy the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryPolicy(RetryPolicy retryPolicy) { - this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); - return this; - } - - /** - * Sets the retry options for the HTTP pipeline retry policy. - *

- * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. - * - * @param retryOptions the retry options for the HTTP pipeline retry policy. - * @return the configurable object itself. - */ - public Configurable withRetryOptions(RetryOptions retryOptions) { - this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); - return this; - } - - public RetryPolicy getRetryPolicy() { - if (retryPolicy == null) { - if (retryOptions != null) { - retryPolicy = new RetryPolicy(retryOptions); - } else { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); - } - } - return retryPolicy; - } - } - - @Test - public void testManagerConfigurableRetryOptions() throws Exception { - // not configured - Configurable configurable = new Configurable(); - validateRetryPolicy(configurable.getRetryPolicy(), false); - - // configured as FixedDelayOptions - configurable = new Configurable().withRetryOptions(new RetryOptions(new FixedDelayOptions(3, Duration.ofSeconds(10)))); - validateRetryPolicy(configurable.getRetryPolicy(), true, FixedDelay.class); - - // configured as ExponentialBackoffOptions - configurable = new Configurable().withRetryOptions(new RetryOptions(new ExponentialBackoffOptions())); - validateRetryPolicy(configurable.getRetryPolicy(), true); - - // RetryPolicy override RetryOptions - configurable = new Configurable().withRetryPolicy(new RetryPolicy()).withRetryOptions(new RetryOptions(new FixedDelayOptions(3, Duration.ofSeconds(10)))); - validateRetryPolicy(configurable.getRetryPolicy(), true, ExponentialBackoff.class); - } - - private static void validateRetryPolicy(RetryPolicy retryPolicy, boolean retryAfterHeaderAsNull) throws NoSuchFieldException, IllegalAccessException { - validateRetryPolicy(retryPolicy, retryAfterHeaderAsNull, null); - } - - private static void validateRetryPolicy(RetryPolicy retryPolicy, boolean retryAfterHeaderAsNull, Class retryStrategyClass) throws NoSuchFieldException, IllegalAccessException { - Assertions.assertNotNull(retryPolicy); - - Field retryAfterHeaderField = RetryPolicy.class.getDeclaredField("retryAfterHeader"); - Field retryAfterTimeUnitField = RetryPolicy.class.getDeclaredField("retryAfterTimeUnit"); - Field retryStrategyField = RetryPolicy.class.getDeclaredField("retryStrategy"); - - retryAfterHeaderField.setAccessible(true); - retryAfterTimeUnitField.setAccessible(true); - retryStrategyField.setAccessible(true); - HttpHeaderName retryAfterHeader = (HttpHeaderName) retryAfterHeaderField.get(retryPolicy); - ChronoUnit retryAfterTimeUnit = (ChronoUnit) retryAfterTimeUnitField.get(retryPolicy); - if (retryAfterHeaderAsNull) { - Assertions.assertNull(retryAfterHeader); - } else { - Assertions.assertEquals("retry-after", retryAfterHeader.getCaseInsensitiveName()); - Assertions.assertEquals(ChronoUnit.SECONDS, retryAfterTimeUnit); - } - - if (retryStrategyClass != null) { - RetryStrategy retryStrategy = (RetryStrategy) retryStrategyField.get(retryPolicy); - Assertions.assertTrue(retryStrategyClass.isAssignableFrom(retryStrategy.getClass())); - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/TypeConversionUtilsTests.java b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/TypeConversionUtilsTests.java deleted file mode 100644 index 6f6607b920..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/java/com/microsoft/typespec/http/client/generator/mgmt/util/TypeConversionUtilsTests.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.mgmt.util; - -import com.microsoft.typespec.http.client.generator.mgmt.TestUtils; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ClassType; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.GenericType; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.IType; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.ListType; -import com.microsoft.typespec.http.client.generator.core.model.clientmodel.MapType; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class TypeConversionUtilsTests { - - @BeforeAll - public static void ensurePlugin() { - new TestUtils.MockFluentGen(); - } - - @Test - public void testConversionExpression() { - IType innerType = new ClassType.Builder() - .packageName("com.azure.resourcemanager.mock.fluent.models") - .name("MockResourceInner") - .build(); - - IType mapType = new MapType(innerType); - String convertedExpression = TypeConversionUtils.conversionExpression(mapType, TypeConversionUtils.tempVariableName()); - Assertions.assertEquals("inner.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, inner1 -> new MockResourceImpl(inner1.getValue(), this.manager())))", convertedExpression); - - IType listType = new ListType(innerType); - convertedExpression = TypeConversionUtils.conversionExpression(listType, TypeConversionUtils.tempVariableName()); - Assertions.assertEquals("inner.stream().map(inner1 -> new MockResourceImpl(inner1, this.manager())).collect(Collectors.toList())", convertedExpression); - - IType pagedIterableType = GenericType.pagedIterable(innerType); - convertedExpression = TypeConversionUtils.conversionExpression(pagedIterableType, TypeConversionUtils.tempVariableName()); - Assertions.assertEquals("ResourceManagerUtils.mapPage(inner, inner1 -> new MockResourceImpl(inner1, this.manager()))", convertedExpression); - - IType responseType = GenericType.response(innerType); - convertedExpression = TypeConversionUtils.conversionExpression(responseType, TypeConversionUtils.tempVariableName()); - Assertions.assertEquals("new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), new MockResourceImpl(inner.getValue(), this.manager()))", convertedExpression); - - IType nestedMapType = new MapType(mapType); - convertedExpression = TypeConversionUtils.conversionExpression(nestedMapType, TypeConversionUtils.tempVariableName()); - Assertions.assertEquals("inner.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, inner1 -> inner1.getValue().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, inner2 -> new MockResourceImpl(inner2.getValue(), this.manager())))))", convertedExpression); - - IType nestedListType = new ListType(listType); - convertedExpression = TypeConversionUtils.conversionExpression(nestedListType, TypeConversionUtils.tempVariableName()); - Assertions.assertEquals("inner.stream().map(inner1 -> inner1.stream().map(inner2 -> new MockResourceImpl(inner2, this.manager())).collect(Collectors.toList())).collect(Collectors.toList())", convertedExpression); - } - - private void expressionsWorkbench() { - { - // map - Map inner = new HashMap(); - Map impl = - inner.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, inner1 -> new MockResourceImpl(inner1.getValue(), this.manager()))); - } - - { - // nested map - Map> inner = new HashMap(); - Map> impl = - inner.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, inner1 -> inner1.getValue().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, inner2 -> new MockResourceImpl(inner2.getValue(), this.manager()))))); - } - - { - // nested list - List> inner = new ArrayList<>(); - List> impl = - inner.stream().map(inner1 -> inner1.stream().map(inner2 -> new MockResourceImpl(inner2, this.manager())).collect(Collectors.toList())).collect(Collectors.toList()); - } - } - - private String manager() { - return null; - } - - private static class MockInner { - } - - private static class MockResourceImpl { - public MockResourceImpl(MockInner inner, String manager) { - // do nothing - } - } -} diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension deleted file mode 100644 index 1c52e6d518..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension +++ /dev/null @@ -1 +0,0 @@ -com.microsoft.typespec.http.client.generator.mgmt.BeforeAllTestsExtension \ No newline at end of file diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-botservice.yaml b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-botservice.yaml deleted file mode 100644 index 8354fed70c..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-botservice.yaml +++ /dev/null @@ -1,15553 +0,0 @@ -!!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel &id001 -apiVersions: [] -clients: [] -globalParameters: - - &id005 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattened: false - implementation: CLIENT - language: - default: - { - description: Azure Subscription ID., - name: SubscriptionId, - serializedName: subscriptionId, - } - java: - { - description: Azure Subscription ID., - name: subscriptionId, - serializedName: subscriptionId, - } - nullable: false - operation: &id002 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: Default error response, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id014 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: Bot Service error object., name: Error, namespace: "" } - java: { description: Bot Service error object., name: ManagementError } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error body., name: error } - java: { description: The error body., name: error } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: Bot Service error body., name: ErrorBody, namespace: "" } - java: { description: Bot Service error body., name: ManagementError } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: error code, name: code } - java: { description: error code, name: code } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id337 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: error code, name: ErrorBodyCode } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: code - - apiVersions: [] - isDiscriminator: false - language: - default: { description: error message, name: message } - java: { description: error message, name: message } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id338 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: error message, name: ErrorBodyMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - serializedName: error - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Private Link Resources: - parameters: - { - api-version: 2021-05-01-preview, - resourceGroupName: res6977, - resourceName: sto2527, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListPrivateLinkResources.json - responses: - "200": - body: - value: - - name: resource1 - type: Microsoft.BotService/botServices/privateLinkResources - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.BotService/botServices/sto2527/privateLinkResources/resource1 - properties: - groupId: bot - requiredMembers: [bot] - requiredZoneNames: [privatelink.botframework.com] - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets the private link resources that need to be created - for a Bot., name: ListByBotResource } - java: { description: Gets the private link resources that need to be created - for a Bot., name: listByBotResource } - operationGroup: &id200 - $key: PrivateLinkResources - codeModel: *id001 - language: - default: { description: "", name: PrivateLinkResources } - java: { description: "", name: PrivateLinkResources } - operations: - - *id002 - protocol: {} - operationId: PrivateLinkResources_ListByBotResource - parameters: - - &id006 - apiVersions: [] - clientDefaultValue: https://management.azure.com - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: CLIENT - language: - default: { description: server parameter, name: endpoint, serializedName: $host } - java: { description: server parameter, name: endpoint, serializedName: $host } - nullable: false - operation: *id002 - origin: modelerfour:synthesized/host - protocol: - http: { explode: false, in: URI } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id004 - apiVersions: [] - language: - default: { description: simple string, name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - &id007 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id002 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id003 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: "", name: String } - maxLength: 64.0 - minLength: 2.0 - pattern: ^[a-zA-Z0-9][a-zA-Z0-9_.-]*$ - protocol: {} - type: STRING - - &id008 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id002 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id009 - apiVersions: [] - flattened: false - implementation: CLIENT - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id002 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id254 - apiVersions: [] - language: - default: - { description: Api Version (2021-05-01-preview), name: ApiVersion20210501Preview } - protocol: {} - type: CONSTANT - value: { value: 2021-05-01-preview } - valueType: *id004 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id007 - - *id008 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id002 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id051 - apiVersions: [] - language: - default: { description: "Accept: application/json", name: Accept } - protocol: {} - type: CONSTANT - value: { value: application/json } - valueType: *id004 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateLinkResources", - uri: "{$host}", - } - signatureParameters: - - *id007 - - *id008 - responses: - - language: - default: { description: Successfully retrieved private link resources., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id284 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: A list of private link resources, - name: PrivateLinkResourceListResult, - namespace: "", - } - java: - { - description: A list of private link resources, - name: PrivateLinkResourceListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Array of private link resources, name: value } - java: { description: Array of private link resources, name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id218 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id011 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: A private link resource, - name: PrivateLinkResource, - namespace: "", - } - java: { description: A private link resource, name: PrivateLinkResource } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id010 - apiVersions: - - { version: 2021-05-01-preview } - children: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id012 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The Private Endpoint Connection resource., - name: PrivateEndpointConnection, - namespace: "", - } - java: - { - description: The Private Endpoint Connection resource., - name: PrivateEndpointConnection, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id010 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id013 - apiVersions: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - java: { name: ProxyResource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - java: { description: the fully qualified resource ID - for the resource, name: id } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the name of the resource, name: name } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the type of the resource, name: type } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: type - stronglyTypedHeader: false - immediate: - - *id010 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Resource properties., name: properties } - java: { description: Resource properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id260 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: true - language: - default: - { - description: Properties of the PrivateEndpointConnectProperties., - name: PrivateEndpointConnectionProperties, - namespace: "", - } - java: - { - description: Properties of the PrivateEndpointConnectProperties., - name: PrivateEndpointConnectionProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The resource of private end point., - name: privateEndpoint, - } - java: - { - description: The resource of private end point., - name: privateEndpoint, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id261 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The Private Endpoint resource., - name: PrivateEndpoint, - namespace: "", - } - java: - { - description: The Private Endpoint resource., - name: PrivateEndpoint, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The ARM identifier for Private - Endpoint, name: Id } - java: - { description: The ARM identifier for Private - Endpoint, name: id } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id324 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The ARM identifier for - Private Endpoint, name: PrivateEndpointId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: privateEndpoint - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A collection of information about - the state of the connection between service consumer - and provider., name: privateLinkServiceConnectionState } - java: { description: A collection of information about - the state of the connection between service consumer - and provider., name: privateLinkServiceConnectionState } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id262 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: A collection of information - about the state of the connection between service - consumer and provider., name: PrivateLinkServiceConnectionState, namespace: "" } - java: { description: A collection of information about - the state of the connection between service consumer - and provider., name: PrivateLinkServiceConnectionState } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Indicates whether the connection - has been Approved/Rejected/Removed by the owner - of the service., name: status } - java: - { description: Indicates whether the connection - has been Approved/Rejected/Removed by the owner - of the service., name: status } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id248 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: PENDING } - value: Pending - - language: - default: { description: "", name: APPROVED } - value: Approved - - language: - default: { description: "", name: REJECTED } - value: Rejected - language: - default: - { description: The private endpoint connection - status., name: PrivateEndpointServiceConnectionStatus } - java: - { description: The private endpoint connection - status., name: PrivateEndpointServiceConnectionStatus } - protocol: {} - type: CHOICE - serializedName: status - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The reason for approval/rejection - of the connection., name: description } - java: - { description: The reason for approval/rejection - of the connection., name: description } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id325 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - The reason for approval/rejection - of the connection., - name: PrivateLinkServiceConnectionStateDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A message indicating if changes - on the service provider require any updates - on the consumer., name: actionsRequired } - java: - { description: A message indicating if changes - on the service provider require any updates - on the consumer., name: actionsRequired } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id326 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: A message indicating if - changes on the service provider require any - updates on the consumer., name: PrivateLinkServiceConnectionStateActionsRequired } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: actionsRequired - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: privateLinkServiceConnectionState - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The provisioning state of the - private endpoint connection resource., name: provisioningState } - java: - { description: The provisioning state of the private - endpoint connection resource., name: provisioningState } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id249 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: SUCCEEDED } - value: Succeeded - - language: - default: { description: "", name: CREATING } - value: Creating - - language: - default: { description: "", name: DELETING } - value: Deleting - - language: - default: { description: "", name: FAILED } - value: Failed - language: - default: - { - description: The current provisioning state., - name: PrivateEndpointConnectionProvisioningState, - } - java: - { - description: The current provisioning state., - name: PrivateEndpointConnectionProvisioningState, - } - protocol: {} - type: CHOICE - serializedName: provisioningState - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id011 - immediate: - - *id012 - - *id011 - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: { description: Common fields that are returned in the - response for all BotService Private Link Resources, name: PrivateLinkResourceBase, namespace: "", summary: Private Link Resource Base } - java: { description: Common fields that are returned in the response - for all BotService Private Link Resources, name: PrivateLinkResourceBase } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id013 - immediate: - - *id013 - properties: [] - protocol: {} - stronglyTypedHeader: false - summary: Private Link Resource Base - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - *id013 - immediate: - - *id010 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Resource properties., name: properties } - java: { description: Resource properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id285 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: true - language: - default: - { - description: Properties of a private link resource., - name: PrivateLinkResourceProperties, - namespace: "", - } - java: - { - description: Properties of a private link resource., - name: PrivateLinkResourceProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The private link resource group id., - name: groupId, - } - java: - { - description: The private link resource group id., - name: groupId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id408 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The private link resource group id., - name: PrivateLinkResourcePropertiesGroupId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: groupId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The private link resource required member - names., name: requiredMembers } - java: { description: The private link resource required member - names., name: requiredMembers } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id216 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id409 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: "", - name: PrivateLinkResourcePropertiesRequiredMembersItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The private link resource required - member names., name: PrivateLinkResourcePropertiesRequiredMembers } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: requiredMembers - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The private link resource Private link - DNS zone name., name: requiredZoneNames } - java: { description: The private link resource Private link DNS - zone name., name: requiredZoneNames } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id217 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id410 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: "", - name: PrivateLinkResourcePropertiesRequiredZoneNamesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The private link resource Private link - DNS zone name., name: PrivateLinkResourcePropertiesRequiredZoneNames } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: requiredZoneNames - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: Array of private link resources, - name: PrivateLinkResourceListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id007 - - *id008 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id049 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id006 - - *id009 -info: { description: Azure Bot Service is a platform for creating smart conversational - agents., title: Azure Bot Service } -language: - default: { description: "", name: AzureBotService } - java: { description: "", name: AzureBotService } -operationGroups: - - &id015 - $key: Bots - codeModel: *id001 - language: - default: { description: "", name: Bots } - java: { description: "", name: Bots } - operations: - - &id016 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create Bot: - parameters: - api-version: 2021-05-01-preview - parameters: - etag: etag1 - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - developerAppInsightKey: appinsightskey - developerAppInsightsApiKey: appinsightsapikey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - endpoint: http://mybot.coffee - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - luisKey: luiskey - msaAppId: exampleappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: exampleapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - sku: { name: S1 } - tags: { tag1: value1, tag2: value2 } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/CreateBot.json - responses: - "200": - body: - name: samplebotname - type: Microsoft.BotService/botServices - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - configuredChannels: [facebook, groupme] - developerAppInsightKey: appinsightskey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - enabledChannels: [facebook] - endpoint: http://mybot.coffee - endpointVersion: version - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - tags: { tag1: value1, tag2: value2 } - "201": - body: - name: samplebotname - type: Microsoft.BotService/botServices - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - configuredChannels: [facebook, groupme] - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - enabledChannels: [facebook] - endpoint: http://mybot.coffee - endpointVersion: version - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - tags: { tag1: value1, tag2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Creates a Bot Service. Bot Service is a resource group - wide resource type., name: Create } - java: { description: Creates a Bot Service. Bot Service is a resource group wide - resource type., name: create } - operationGroup: *id015 - operationId: Bots_Create - parameters: - - *id006 - - &id017 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id016 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id018 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id016 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id017 - - *id018 - - *id009 - - *id005 - - &id052 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for the created bot., - name: parameters, - } - java: - { - description: The parameters to provide for the created bot., - name: parameters, - } - nullable: false - operation: *id016 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id019 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: Bot resource definition, name: Bot, namespace: "" } - java: { description: Bot resource definition, name: Bot } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id021 - apiVersions: - - { version: 2021-05-01-preview } - children: - all: - - *id019 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id020 - apiVersions: - - { version: 2021-05-01-preview } - children: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id043 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The ARM channel of list channel with - keys operation response., name: ListChannelWithKeysResponse, namespace: "" } - java: { description: The ARM channel of list channel with keys - operation response., name: ListChannelWithKeysResponse } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - - *id021 - immediate: - - *id020 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The set of properties specific to - bot channel resource, name: resource } - java: { description: The set of properties specific to bot - channel resource, name: resource } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id022 - apiVersions: - - { version: 2021-05-01-preview } - children: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id029 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: AlexaChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Alexa channel definition, - name: AlexaChannel, - namespace: "", - } - java: - { - description: Alexa channel definition, - name: AlexaChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Alexa channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Alexa channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id286 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Alexa channel., name: AlexaChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Alexa channel., name: AlexaChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Alexa skill Id, - name: alexaSkillId, - } - java: - { - description: The Alexa skill Id, - name: alexaSkillId, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id411 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Alexa skill Id, - name: AlexaChannelPropertiesAlexaSkillId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: alexaSkillId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Url fragment used in - part of the Uri configured in Alexa, name: urlFragment } - java: - { - description: - Url fragment used in part - of the Uri configured in Alexa, - name: urlFragment, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id412 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Url fragment used in - part of the Uri configured in Alexa, name: AlexaChannelPropertiesUrlFragment } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: urlFragment - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Full Uri used to configured - the skill in Alexa, - name: serviceEndpointUri, - } - java: - { - description: - Full Uri used to configured - the skill in Alexa, - name: serviceEndpointUri, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id413 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - Full Uri used to configured - the skill in Alexa, - name: AlexaChannelPropertiesServiceEndpointUri, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: serviceEndpointUri - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id023 - apiVersions: [] - language: - default: - { description: Whether this channel - is enabled for the bot, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id030 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: FacebookChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Facebook channel definition, - name: FacebookChannel, - namespace: "", - } - java: - { - description: Facebook channel definition, - name: FacebookChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to bot facebook channel, - name: properties, - } - java: - { - description: - The set of properties specific - to bot facebook channel, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id287 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Facebook channel., name: FacebookChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Facebook channel., name: FacebookChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: "Verify token. Value - only returned through POST to the action - Channel List API, otherwise empty.", name: verifyToken } - java: - { - description: - "Verify token. Value only - returned through POST to the action Channel - List API, otherwise empty.", - name: verifyToken, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id414 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: "Verify token. Value - only returned through POST to the action - Channel List API, otherwise empty.", name: FacebookChannelPropertiesVerifyToken } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: verifyToken - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The list of Facebook - pages, name: pages } - java: - { - description: The list of Facebook pages, - name: pages, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id219 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id288 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: A Facebook page for - Facebook channel registration, name: FacebookPage, namespace: "" } - java: - { description: A Facebook page for - Facebook channel registration, name: FacebookPage } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Page id, - name: Id, - } - java: - { - description: Page id, - name: id, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id415 - apiVersions: - - { - version: 2021-05-01-preview, - } - language: - default: - { - description: Page id, - name: FacebookPageId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - "Facebook application - access token. Value only returned - through POST to the action Channel - List API, otherwise empty.", - name: accessToken, - } - java: - { - description: - "Facebook application - access token. Value only returned - through POST to the action Channel - List API, otherwise empty.", - name: accessToken, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id416 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: - "Facebook application - access token. Value only returned - through POST to the action Channel - List API, otherwise empty.", - name: FacebookPageAccessToken, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: accessToken - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: The list of Facebook - pages, name: FacebookChannelPropertiesPages } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: pages - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Facebook application - id, name: appId } - java: - { - description: Facebook application id, - name: appId, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id417 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Facebook application - id, name: FacebookChannelPropertiesAppId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: appId - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: "Facebook application - secret. Value only returned through POST - to the action Channel List API, otherwise - empty.", name: appSecret } - java: - { - description: - "Facebook application secret. - Value only returned through POST to the - action Channel List API, otherwise empty.", - name: appSecret, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id418 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: "Facebook application - secret. Value only returned through POST - to the action Channel List API, otherwise - empty.", name: FacebookChannelPropertiesAppSecret } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: appSecret - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Callback Url, - name: callbackUrl, - } - java: - { - description: Callback Url, - name: callbackUrl, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id419 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Callback Url, - name: FacebookChannelPropertiesCallbackUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: callbackUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id031 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: EmailChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Email channel definition, - name: EmailChannel, - namespace: "", - } - java: - { - description: Email channel definition, - name: EmailChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to email channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to email channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id289 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Email channel., name: EmailChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Email channel., name: EmailChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The email address, - name: emailAddress, - } - java: - { - description: The email address, - name: emailAddress, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id420 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The email address, - name: EmailChannelPropertiesEmailAddress, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: emailAddress - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "The password for the - email address. Value only returned through - POST to the action Channel List API, otherwise - empty.", name: password } - java: - { - description: - "The password for the email - address. Value only returned through POST - to the action Channel List API, otherwise - empty.", - name: password, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id421 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: "The password for the - email address. Value only returned through - POST to the action Channel List API, otherwise - empty.", name: EmailChannelPropertiesPassword } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: password - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id032 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: MsTeamsChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Microsoft Teams channel definition, - name: MsTeamsChannel, - namespace: "", - } - java: - { - description: Microsoft Teams channel definition, - name: MsTeamsChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Microsoft Teams channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Microsoft Teams channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id290 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Microsoft Teams channel., name: MsTeamsChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Microsoft Teams channel., name: MsTeamsChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Enable calling for Microsoft - Teams channel, - name: enableCalling, - } - java: - { - description: - Enable calling for Microsoft - Teams channel, - name: enableCalling, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id235 - apiVersions: [] - language: - default: - { description: Enable calling for - Microsoft Teams channel, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enableCalling - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Webhook for Microsoft - Teams channel calls, name: callingWebhook } - java: - { - description: - Webhook for Microsoft Teams - channel calls, - name: callingWebhook, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id422 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Webhook for Microsoft - Teams channel calls, name: MsTeamsChannelPropertiesCallingWebHook } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: callingWebHook - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Webhook for Microsoft - Teams channel calls, name: incomingCallRoute } - java: - { - description: - Webhook for Microsoft Teams - channel calls, - name: incomingCallRoute, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id423 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Webhook for Microsoft - Teams channel calls, name: MsTeamsChannelPropertiesIncomingCallRoute } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: incomingCallRoute - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Deployment environment - for Microsoft Teams channel calls, name: deploymentEnvironment } - java: - { - description: - Deployment environment for - Microsoft Teams channel calls, - name: deploymentEnvironment, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id424 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - Deployment environment - for Microsoft Teams channel calls, - name: MsTeamsChannelPropertiesDeploymentEnvironment, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: deploymentEnvironment - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - accepted terms, name: acceptedTerms } - java: - { - description: - Whether this channel accepted - terms, - name: acceptedTerms, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id236 - apiVersions: [] - language: - default: - { description: Whether this channel - accepted terms, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: acceptedTerms - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id033 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: SkypeChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Skype channel definition, - name: SkypeChannel, - namespace: "", - } - java: - { - description: Skype channel definition, - name: SkypeChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Skype channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Skype channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id291 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Microsoft Teams channel., name: SkypeChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Microsoft Teams channel., name: SkypeChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Enable messaging for - Skype channel, name: enableMessaging } - java: - { - description: - Enable messaging for Skype - channel, - name: enableMessaging, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id237 - apiVersions: [] - language: - default: - { description: Enable messaging for - Skype channel, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enableMessaging - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Enable media cards for - Skype channel, name: enableMediaCards } - java: - { - description: - Enable media cards for Skype - channel, - name: enableMediaCards, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id238 - apiVersions: [] - language: - default: - { description: Enable media cards - for Skype channel, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enableMediaCards - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Enable video for Skype - channel, name: enableVideo } - java: - { - description: Enable video for Skype channel, - name: enableVideo, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id239 - apiVersions: [] - language: - default: - { - description: - Enable video for Skype - channel, - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: enableVideo - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Enable calling for Skype - channel, - name: enableCalling, - } - java: - { - description: - Enable calling for Skype - channel, - name: enableCalling, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id240 - apiVersions: [] - language: - default: - { description: Enable calling for - Skype channel, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enableCalling - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Enable screen sharing - for Skype channel, name: enableScreenSharing } - java: - { - description: - Enable screen sharing for - Skype channel, - name: enableScreenSharing, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id241 - apiVersions: [] - language: - default: - { description: Enable screen sharing - for Skype channel, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enableScreenSharing - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Enable groups for Skype - channel, name: enableGroups } - java: - { description: Enable groups for Skype - channel, name: enableGroups } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id242 - apiVersions: [] - language: - default: - { - description: - Enable groups for Skype - channel, - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: enableGroups - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Group mode for Skype - channel, name: groupsMode } - java: - { - description: Group mode for Skype channel, - name: groupsMode, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id425 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Group mode for Skype - channel, name: SkypeChannelPropertiesGroupsMode } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: groupsMode - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Calling web hook for - Skype channel, name: callingWebhook } - java: - { - description: - Calling web hook for Skype - channel, - name: callingWebhook, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id426 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Calling web hook for - Skype channel, name: SkypeChannelPropertiesCallingWebHook } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: callingWebHook - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Incoming call route for - Skype channel, name: incomingCallRoute } - java: - { description: Incoming call route for - Skype channel, name: incomingCallRoute } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id427 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Incoming call route - for Skype channel, name: SkypeChannelPropertiesIncomingCallRoute } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: incomingCallRoute - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id034 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: KikChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Kik channel definition, - name: KikChannel, - namespace: "", - } - java: - { - description: Kik channel definition, - name: KikChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Kik channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Kik channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id292 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Kik channel., name: KikChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Kik channel., name: KikChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Kik user name, - name: username, - } - java: - { - description: The Kik user name, - name: username, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id428 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Kik user name, - name: KikChannelPropertiesUserName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: userName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "Kik API key. Value only - returned through POST to the action Channel - List API, otherwise empty.", - name: apiKey, - } - java: - { - description: - "Kik API key. Value only - returned through POST to the action Channel - List API, otherwise empty.", - name: apiKey, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id429 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: "Kik API key. Value - only returned through POST to the action - Channel List API, otherwise empty.", name: KikChannelPropertiesApiKey } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: apiKey - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is validated for the bot, name: isValidated } - java: - { description: Whether this channel is - validated for the bot, name: isValidated } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id028 - apiVersions: [] - language: - default: - { description: Whether this channel - is validated for the bot, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isValidated - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id035 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: WebChatChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Web Chat channel definition, - name: WebChatChannel, - namespace: "", - } - java: - { - description: Web Chat channel definition, - name: WebChatChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Web Chat channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Web Chat channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id293 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Web Chat channel., name: WebChatChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Web Chat channel., name: WebChatChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { description: Web chat control embed - code, name: webChatEmbedCode } - java: - { - description: Web chat control embed code, - name: webChatEmbedCode, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id430 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - language: - default: - { - description: - Web chat control embed - code, - name: WebChatChannelPropertiesWebChatEmbedCode, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: webChatEmbedCode - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The list of Web Chat - sites, name: sites } - java: - { - description: The list of Web Chat sites, - name: sites, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id220 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id024 - apiVersions: - - { version: 2021-05-01-preview } - children: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id025 - apiVersions: - - { - version: 2021-05-01-preview, - } - flattenedSchema: false - language: - default: - { - description: - A site for the - channel, - name: Site, - namespace: "", - } - java: - { - description: A site for the channel, - name: Site, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id024 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id027 - apiVersions: - - { - version: 2021-05-01-preview, - } - children: - all: - - *id025 - immediate: - - *id025 - flattenedSchema: false - language: - default: - { - description: - A site for - the Direct Line channel, - name: DirectLineSite, - namespace: "", - } - java: - { - description: - A site for the - Direct Line channel, - name: DirectLineSite, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { - description: Site Id, - name: siteId, - } - java: - { - description: Site Id, - name: siteId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id351 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [read] - xmsSkipUrlEncoding: false - language: - default: - { - description: - Site - Id, - name: DirectLineSiteId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: siteId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Site name, - name: siteName, - } - java: - { - description: Site name, - name: siteName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id352 - apiVersions: - - { - version: 2021-05-01-preview, - } - language: - default: - { - description: - Site - name, - name: DirectLineSiteName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: siteName - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { - description: - "Primary - key. Value only returned through - POST to the action Channel - List API, otherwise empty.", - name: key, - } - java: - { - description: - "Primary key. - Value only returned through - POST to the action Channel - List API, otherwise empty.", - name: key, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id353 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [read] - xmsSkipUrlEncoding: false - language: - default: - { - description: - "Primary - key. Value only returned - through POST to the action - Channel List API, otherwise - empty.", - name: DirectLineSiteKey, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: key - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { - description: - "Secondary - key. Value only returned through - POST to the action Channel - List API, otherwise empty.", - name: key2, - } - java: - { - description: - "Secondary - key. Value only returned through - POST to the action Channel - List API, otherwise empty.", - name: key2, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id354 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [read] - xmsSkipUrlEncoding: false - language: - default: - { - description: - "Secondary - key. Value only returned - through POST to the action - Channel List API, otherwise - empty.", - name: DirectLineSiteKey2, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: key2 - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether - this site is enabled for DirectLine - channel., - name: isEnabled, - } - java: - { - description: - Whether this - site is enabled for DirectLine - channel., - name: isEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id229 - apiVersions: [] - language: - default: - { - description: - Whether - this site is enabled for - DirectLine channel., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: isEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether - this site is enabled for Bot - Framework V1 protocol., - name: isV1Enabled, - } - java: - { - description: - Whether this - site is enabled for Bot Framework - V1 protocol., - name: isV1Enabled, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id026 - apiVersions: [] - language: - default: - { - description: - Whether - this site is enabled for - Bot Framework V1 protocol., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: isV1Enabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether - this site is enabled for Bot - Framework V1 protocol., - name: isV3Enabled, - } - java: - { - description: - Whether this - site is enabled for Bot Framework - V1 protocol., - name: isV3Enabled, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id026 - serializedName: isV3Enabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether - this site is enabled for authentication - with Bot Framework., - name: isSecureSiteEnabled, - } - java: - { - description: - Whether this - site is enabled for authentication - with Bot Framework., - name: isSecureSiteEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id230 - apiVersions: [] - language: - default: - { - description: - Whether - this site is enabled for - authentication with Bot - Framework., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: isSecureSiteEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether - this site is enabled for block - user upload., - name: isBlockUserUploadEnabled, - } - java: - { - description: - Whether this - site is enabled for block - user upload., - name: isBlockUserUploadEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id231 - apiVersions: [] - language: - default: - { - description: - Whether - this site is enabled for - block user upload., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: isBlockUserUploadEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - List of - Trusted Origin URLs for this - site. This field is applicable - only if isSecureSiteEnabled - is True., - name: trustedOrigins, - } - java: - { - description: - List of Trusted - Origin URLs for this site. - This field is applicable only - if isSecureSiteEnabled is - True., - name: trustedOrigins, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id207 - apiVersions: - - { - version: 2021-05-01-preview, - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id355 - apiVersions: - - { - version: 2021-05-01-preview, - } - language: - default: - { - description: "", - name: DirectLineSiteTrustedOriginsItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { - description: - List - of Trusted Origin URLs for - this site. This field is - applicable only if isSecureSiteEnabled - is True., - name: DirectLineSiteTrustedOrigins, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: trustedOrigins - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - immediate: - - *id024 - - *id027 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether this - site is token enabled for channel, - name: isTokenEnabled, - } - java: - { - description: - Whether this site - is token enabled for channel, - name: isTokenEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id226 - apiVersions: [] - language: - default: - { - description: - Whether this - site is token enabled for channel, - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: isTokenEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Entity Tag, - name: etag, - } - java: - { - description: Entity Tag, - name: etag, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id346 - apiVersions: - - { - version: 2021-05-01-preview, - } - language: - default: - { - description: Entity Tag, - name: SiteETag, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: eTag - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - immediate: - - *id025 - flattenedSchema: false - language: - default: - { - description: - A site for the Webchat - channel, - name: WebChatSite, - namespace: "", - } - java: - { - description: - A site for the Webchat - channel, - name: WebChatSite, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { - description: Site Id, - name: siteId, - } - java: - { - description: Site Id, - name: siteId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id347 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - language: - default: - { - description: Site Id, - name: WebChatSiteId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: siteId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Site name, - name: siteName, - } - java: - { - description: Site name, - name: siteName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id348 - apiVersions: - - { - version: 2021-05-01-preview, - } - language: - default: - { - description: Site name, - name: WebChatSiteName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: siteName - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { - description: - "Primary key. Value - only returned through POST to the - action Channel List API, otherwise - empty.", - name: key, - } - java: - { - description: - "Primary key. Value - only returned through POST to the - action Channel List API, otherwise - empty.", - name: key, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id349 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - language: - default: - { description: "Primary key. - Value only returned through POST - to the action Channel List API, - otherwise empty.", name: WebChatSiteKey } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: key - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { description: "Secondary key. - Value only returned through POST to - the action Channel List API, otherwise - empty.", name: key2 } - java: - { - description: - "Secondary key. Value - only returned through POST to the - action Channel List API, otherwise - empty.", - name: key2, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id350 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - language: - default: - { - description: - "Secondary key. - Value only returned through POST - to the action Channel List API, - otherwise empty.", - name: WebChatSiteKey2, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: key2 - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether this site - is enabled for DirectLine channel, - name: isEnabled, - } - java: - { - description: - Whether this site - is enabled for DirectLine channel, - name: isEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id227 - apiVersions: [] - language: - default: - { description: Whether this - site is enabled for DirectLine channel, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether this site - is enabled for preview versions of - Webchat, - name: isWebchatPreviewEnabled, - } - java: - { - description: - Whether this site - is enabled for preview versions of - Webchat, - name: isWebchatPreviewEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id228 - apiVersions: [] - defaultValue: false - language: - default: - { description: Whether this - site is enabled for preview versions - of Webchat, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isWebchatPreviewEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: The list of Web Chat - sites, name: WebChatChannelPropertiesSites } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: sites - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id036 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: DirectLineChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Direct Line channel definition, - name: DirectLineChannel, - namespace: "", - } - java: - { - description: Direct Line channel definition, - name: DirectLineChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Direct Line channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Direct Line channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id294 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Direct Line channel., name: DirectLineChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Direct Line channel., name: DirectLineChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The list of Direct Line - sites, name: sites } - java: - { description: The list of Direct Line - sites, name: sites } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id221 - apiVersions: - - { version: 2021-05-01-preview } - elementType: *id027 - language: - default: - { description: The list of Direct - Line sites, name: DirectLineChannelPropertiesSites } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: sites - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Direct Line embed code - of the resource, name: directLineEmbedCode } - java: - { - description: - Direct Line embed code of - the resource, - name: directLineEmbedCode, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id431 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - Direct Line embed code - of the resource, - name: DirectLineChannelPropertiesDirectLineEmbedCode, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: DirectLineEmbedCode - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id037 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: TelegramChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Telegram channel definition, - name: TelegramChannel, - namespace: "", - } - java: - { - description: Telegram channel definition, - name: TelegramChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Telegram channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Telegram channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id295 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Telegram channel., name: TelegramChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Telegram channel., name: TelegramChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: "The Telegram access - token. Value only returned through POST - to the action Channel List API, otherwise - empty.", name: accessToken } - java: - { - description: - "The Telegram access token. - Value only returned through POST to the - action Channel List API, otherwise empty.", - name: accessToken, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id432 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: "The Telegram access - token. Value only returned through POST - to the action Channel List API, otherwise - empty.", name: TelegramChannelPropertiesAccessToken } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: accessToken - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is validated for the bot, name: isValidated } - java: - { description: Whether this channel is - validated for the bot, name: isValidated } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id028 - serializedName: isValidated - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id038 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: SmsChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Sms channel definition, - name: SmsChannel, - namespace: "", - } - java: - { - description: Sms channel definition, - name: SmsChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Sms channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Sms channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id296 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Sms channel., name: SmsChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Sms channel., name: SmsChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Sms phone, - name: phone, - } - java: - { - description: The Sms phone, - name: phone, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id433 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Sms phone, - name: SmsChannelPropertiesPhone, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: phone - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "The Sms account SID. - Value only returned through POST to the - action Channel List API, otherwise empty.", name: accountSid } - java: - { - description: - "The Sms account SID. Value - only returned through POST to the action - Channel List API, otherwise empty.", - name: accountSid, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id434 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: "The Sms account SID. - Value only returned through POST to the - action Channel List API, otherwise empty.", name: SmsChannelPropertiesAccountSid } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: accountSID - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: "The Sms auth token. - Value only returned through POST to the - action Channel List API, otherwise empty.", name: authToken } - java: - { - description: - "The Sms auth token. Value - only returned through POST to the action - Channel List API, otherwise empty.", - name: authToken, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id435 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: "The Sms auth token. - Value only returned through POST to the - action Channel List API, otherwise empty.", name: SmsChannelPropertiesAuthToken } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: authToken - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is validated for the bot, name: isValidated } - java: - { description: Whether this channel is - validated for the bot, name: isValidated } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id028 - serializedName: isValidated - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id039 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: SlackChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Slack channel definition, - name: SlackChannel, - namespace: "", - } - java: - { - description: Slack channel definition, - name: SlackChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to Slack channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to Slack channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id297 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Slack channel., name: SlackChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Slack channel., name: SlackChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Slack client id, - name: clientId, - } - java: - { - description: The Slack client id, - name: clientId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id436 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Slack client id, - name: SlackChannelPropertiesClientId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: clientId - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - "The Slack client secret. - Value only returned through POST to the - action Channel List API, otherwise empty.", - name: clientSecret, - } - java: - { - description: - "The Slack client secret. - Value only returned through POST to the - action Channel List API, otherwise empty.", - name: clientSecret, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id437 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: - "The Slack client secret. - Value only returned through POST to the - action Channel List API, otherwise empty.", - name: SlackChannelPropertiesClientSecret, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: clientSecret - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: "The Slack verification - token. Value only returned through POST - to the action Channel List API, otherwise - empty.", name: verificationToken } - java: - { description: "The Slack verification - token. Value only returned through POST - to the action Channel List API, otherwise - empty.", name: verificationToken } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id438 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: - "The Slack verification - token. Value only returned through POST - to the action Channel List API, otherwise - empty.", - name: SlackChannelPropertiesVerificationToken, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: verificationToken - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The Slack permission - scopes., name: scopes } - java: - { - description: The Slack permission scopes., - name: scopes, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id439 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: The Slack permission - scopes., name: SlackChannelPropertiesScopes } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: scopes - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The Slack landing page - Url, name: landingPageUrl } - java: - { - description: The Slack landing page Url, - name: landingPageUrl, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id440 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - The Slack landing page - Url, - name: SlackChannelPropertiesLandingPageUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: landingPageUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Slack redirect action, - name: redirectAction, - } - java: - { - description: The Slack redirect action, - name: redirectAction, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id441 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: The Slack redirect - action, name: SlackChannelPropertiesRedirectAction } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: redirectAction - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Sms auth token, - name: lastSubmissionId, - } - java: - { - description: The Sms auth token, - name: lastSubmissionId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id442 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Sms auth token, - name: SlackChannelPropertiesLastSubmissionId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: lastSubmissionId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether to register the - settings before OAuth validation is performed. - Recommended to True., name: registerBeforeOAuthFlow } - java: - { description: Whether to register the - settings before OAuth validation is performed. - Recommended to True., name: registerBeforeOAuthFlow } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id243 - apiVersions: [] - language: - default: - { description: Whether to register - the settings before OAuth validation is - performed. Recommended to True., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: registerBeforeOAuthFlow - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is validated for the bot, name: IsValidated } - java: - { description: Whether this channel is - validated for the bot, name: isValidated } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id028 - serializedName: IsValidated - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: The Slack signing secret., - name: signingSecret, - } - java: - { - description: The Slack signing secret., - name: signingSecret, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id443 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The Slack signing secret., - name: SlackChannelPropertiesSigningSecret, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: signingSecret - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled for the bot, name: isEnabled } - java: - { description: Whether this channel is - enabled for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id023 - serializedName: isEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id040 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: LineChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: Line channel definition, - name: LineChannel, - namespace: "", - } - java: - { - description: Line channel definition, - name: LineChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to line channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to line channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id298 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the Line channel., name: LineChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the Line channel., name: LineChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The list of line channel - registrations, - name: lineRegistrations, - } - java: - { - description: - The list of line channel - registrations, - name: lineRegistrations, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id222 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id299 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: - The properties corresponding - to a line channel registration, - name: LineRegistration, - namespace: "", - } - java: - { - description: - The properties corresponding - to a line channel registration, - name: LineRegistration, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { - description: - Id generated for - the line channel registration, - name: generatedId, - } - java: - { - description: - Id generated for the - line channel registration, - name: generatedId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id444 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read] - xmsSkipUrlEncoding: false - language: - default: - { description: Id generated - for the line channel registration, name: LineRegistrationGeneratedId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: generatedId - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Secret for the - line channel registration, name: channelSecret } - java: - { - description: - Secret for the line - channel registration, - name: channelSecret, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id445 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: - Secret for the - line channel registration, - name: LineRegistrationChannelSecret, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: channelSecret - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - Access token for - the line channel registration, - name: channelAccessToken, - } - java: - { - description: - Access token for the - line channel registration, - name: channelAccessToken, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id446 - apiVersions: - - { - version: 2021-05-01-preview, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Access token - for the line channel registration, name: LineRegistrationChannelAccessToken } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: channelAccessToken - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: - The list of line channel - registrations, - name: LineChannelPropertiesLineRegistrations, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: lineRegistrations - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Callback Url to enter - in line registration., name: callbackUrl } - java: - { - description: - Callback Url to enter in - line registration., - name: callbackUrl, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id447 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Callback Url to enter - in line registration., name: LineChannelPropertiesCallbackUrl } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: callbackUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is validated for the bot, name: isValidated } - java: - { description: Whether this channel is - validated for the bot, name: isValidated } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id028 - serializedName: isValidated - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id041 - apiVersions: - - { version: 2021-05-01-preview } - discriminatorValue: DirectLineSpeechChannel - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: DirectLine Speech channel definition, - name: DirectLineSpeechChannel, - namespace: "", - } - java: - { - description: DirectLine Speech channel definition, - name: DirectLineSpeechChannel, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id022 - immediate: - - *id022 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The set of properties specific - to DirectLine Speech channel resource, - name: properties, - } - java: - { - description: - The set of properties specific - to DirectLine Speech channel resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id300 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: The parameters to provide - for the DirectLine Speech channel., name: DirectLineSpeechChannelProperties, namespace: "" } - java: - { description: The parameters to provide - for the DirectLine Speech channel., name: DirectLineSpeechChannelProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The cognitive service - region with this channel registration., name: cognitiveServiceRegion } - java: - { - description: - The cognitive service region - with this channel registration., - name: cognitiveServiceRegion, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id448 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: The cognitive service - region with this channel registration., name: DirectLineSpeechChannelPropertiesCognitiveServiceRegion } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: cognitiveServiceRegion - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The cognitive service - subscription key to use with this channel - registration., name: cognitiveServiceSubscriptionKey } - java: - { - description: - The cognitive service subscription - key to use with this channel registration., - name: cognitiveServiceSubscriptionKey, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id449 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: The cognitive service - subscription key to use with this channel - registration., name: DirectLineSpeechChannelPropertiesCognitiveServiceSubscriptionKey } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: cognitiveServiceSubscriptionKey - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel - is enabled or not., name: isEnabled } - java: - { description: Whether this channel is - enabled or not., name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id244 - apiVersions: [] - language: - default: - { description: Whether this channel - is enabled or not., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Custom speech model id - (optional)., name: customVoiceDeploymentId } - java: - { - description: Custom speech model id (optional)., - name: customVoiceDeploymentId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id450 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Custom speech model - id (optional)., name: DirectLineSpeechChannelPropertiesCustomVoiceDeploymentId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: customVoiceDeploymentId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Custom voice deployment - id (optional)., name: customSpeechModelId } - java: - { description: Custom voice deployment - id (optional)., name: customSpeechModelId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id451 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - Custom voice deployment - id (optional)., - name: DirectLineSpeechChannelPropertiesCustomSpeechModelId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: customSpeechModelId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Make this a default bot - for chosen cognitive service account., name: isDefaultBotForCogSvcAccount } - java: - { description: Make this a default bot - for chosen cognitive service account., name: isDefaultBotForCogSvcAccount } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id245 - apiVersions: [] - language: - default: - { description: Make this a default - bot for chosen cognitive service account., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isDefaultBotForCogSvcAccount - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - immediate: - - *id029 - - *id030 - - *id031 - - *id032 - - *id033 - - *id034 - - *id035 - - *id036 - - *id037 - - *id038 - - *id039 - - *id040 - - *id041 - discriminator: - all: - AlexaChannel: *id029 - DirectLineChannel: *id036 - DirectLineSpeechChannel: *id041 - EmailChannel: *id031 - FacebookChannel: *id030 - KikChannel: *id034 - LineChannel: *id040 - MsTeamsChannel: *id032 - SkypeChannel: *id033 - SlackChannel: *id039 - SmsChannel: *id038 - TelegramChannel: *id037 - WebChatChannel: *id035 - immediate: - AlexaChannel: *id029 - DirectLineChannel: *id036 - DirectLineSpeechChannel: *id041 - EmailChannel: *id031 - FacebookChannel: *id030 - KikChannel: *id034 - LineChannel: *id040 - MsTeamsChannel: *id032 - SkypeChannel: *id033 - SlackChannel: *id039 - SmsChannel: *id038 - TelegramChannel: *id037 - WebChatChannel: *id035 - property: &id042 - apiVersions: [] - isDiscriminator: true - language: - default: - { - description: The channel name, - name: channelName, - } - java: - { - description: The channel name, - name: channelName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id340 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The channel name, - name: ChannelName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: channelName - flattenedSchema: false - language: - default: - { - description: Channel definition, - name: Channel, - namespace: "", - } - java: { description: Channel definition, name: Channel } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - *id042 - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Entity Tag of the resource, - name: etag, - } - java: - { - description: Entity Tag of the resource, - name: etag, - } - nullable: true - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id341 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Entity Tag of the resource, - name: ChannelEtag, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: etag - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Provisioning state of the resource, - name: provisioningState, - } - java: - { - description: Provisioning state of the resource, - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id342 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Provisioning state of the resource, - name: ChannelProvisioningState, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Specifies the location of the - resource., name: location } - java: - { - description: Specifies the location of the resource., - name: location, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id343 - apiVersions: - - { version: 2021-05-01-preview } - defaultValue: global - language: - default: - { description: Specifies the location of the - resource., name: ChannelLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: location - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: resource - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Channel settings, name: setting } - java: { description: Channel settings, name: setting } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id264 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: Channel settings definition, - name: ChannelSettings, - namespace: "", - } - java: - { - description: Channel settings definition, - name: ChannelSettings, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The extensionKey1, - name: extensionKey1, - } - java: - { - description: The extensionKey1, - name: extensionKey1, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id344 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The extensionKey1, - name: ChannelSettingsExtensionKey1, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: extensionKey1 - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The extensionKey2, - name: extensionKey2, - } - java: - { - description: The extensionKey2, - name: extensionKey2, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id345 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The extensionKey2, - name: ChannelSettingsExtensionKey2, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: extensionKey2 - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The list of sites, name: sites } - java: - { description: The list of sites, name: sites } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id208 - apiVersions: - - { version: 2021-05-01-preview } - elementType: *id025 - language: - default: - { - description: The list of sites, - name: ChannelSettingsSites, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: sites - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The channel id, name: channelId } - java: - { description: The channel id, name: channelId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id356 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The channel id, - name: ChannelSettingsChannelId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: channelId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The channel display name, - name: channelDisplayName, - } - java: - { - description: The channel display name, - name: channelDisplayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id357 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The channel display name, - name: ChannelSettingsChannelDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: channelDisplayName - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The bot id, name: botId } - java: { description: The bot id, name: botId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id358 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The bot id, - name: ChannelSettingsBotId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: botId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The bot icon url, - name: botIconUrl, - } - java: - { - description: The bot icon url, - name: botIconUrl, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id359 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The bot icon url, - name: ChannelSettingsBotIconUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: botIconUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Whether this channel is enabled - for the bot, name: isEnabled } - java: { description: Whether this channel is enabled - for the bot, name: isEnabled } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id023 - serializedName: isEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Opt-out of local authentication - and ensure only MSI and AAD can be used exclusively - for authentication., name: disableLocalAuth } - java: { description: Opt-out of local authentication - and ensure only MSI and AAD can be used exclusively - for authentication., name: disableLocalAuth } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id050 - apiVersions: [] - language: - default: - { description: Opt-out of local authentication - and ensure only MSI and AAD can be used exclusively - for authentication., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: disableLocalAuth - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: setting - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Provisioning state of the resource, - name: provisioningState, - } - java: - { - description: Provisioning state of the resource, - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id360 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Provisioning state of the resource, - name: ListChannelWithKeysResponseProvisioningState, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Entity tag of the resource, - name: entityTag, - } - java: - { - description: Entity tag of the resource, - name: entityTag, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id361 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Entity tag of the resource, - name: ListChannelWithKeysResponseEntityTag, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: entityTag - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Changed time of the resource, - name: changedTime, - } - java: - { - description: Changed time of the resource, - name: changedTime, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id362 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Changed time of the resource, - name: ListChannelWithKeysResponseChangedTime, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: changedTime - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - immediate: - - *id043 - flattenedSchema: false - language: - default: - { - description: Bot channel resource definition, - name: BotChannel, - namespace: "", - } - java: - { description: Bot channel resource definition, name: BotChannel } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id021 - immediate: - - *id021 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The set of properties specific to bot - channel resource, name: properties } - java: - { description: The set of properties specific to bot channel - resource, name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id022 - serializedName: properties - - &id044 - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Gets or sets the SKU of the resource., - name: sku, - } - java: - { - description: Gets or sets the SKU of the resource., - name: sku, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id263 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The SKU of the cognitive services account., - name: Sku, - namespace: "", - } - java: - { - description: The SKU of the cognitive services account., - name: Sku, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The sku name, name: name } - java: { description: The sku name, name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id250 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: F0 } - value: F0 - - language: - default: { description: "", name: S1 } - value: S1 - language: - default: - { description: The name of SKU., name: SkuName } - java: { description: The name of SKU., name: SkuName } - protocol: {} - type: CHOICE - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the sku tier. This is based - on the SKU name., name: tier } - java: { description: Gets the sku tier. This is based on - the SKU name., name: tier } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id251 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: FREE } - value: Free - - language: - default: { description: "", name: STANDARD } - value: Standard - language: - default: { description: Gets the sku tier. This is based - on the SKU name., name: SkuTier } - java: { description: Gets the sku tier. This is based on - the SKU name., name: SkuTier } - protocol: {} - type: CHOICE - serializedName: tier - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: sku - - &id045 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Required. Gets or sets the Kind of the - resource., name: kind } - java: - { - description: Required. Gets or sets the Kind of the resource., - name: kind, - } - nullable: true - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id252 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: SDK } - value: sdk - - language: - default: { description: "", name: DESIGNER } - value: designer - - language: - default: { description: "", name: BOT } - value: bot - - language: - default: { description: "", name: FUNCTION } - value: function - - language: - default: { description: "", name: AZUREBOT } - value: azurebot - language: - default: - { - description: Indicates the type of bot service, - name: Kind, - } - java: - { - description: Indicates the type of bot service, - name: Kind, - } - protocol: {} - type: CHOICE - serializedName: kind - - &id046 - apiVersions: [] - isDiscriminator: false - language: - default: { description: Entity Tag, name: etag } - java: { description: Entity Tag, name: etag } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id335 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: Entity Tag, name: ResourceEtag } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: etag - - &id047 - apiVersions: [] - isDiscriminator: false - language: - default: { description: Entity zones, name: zones } - java: { description: Entity zones, name: zones } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id205 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id336 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: "", name: ResourceZonesItem } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: Entity zones, name: ResourceZones } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: zones - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - *id043 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id048 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: Bot channel resource definition, - name: ConnectionSetting, - namespace: "", - } - java: - { - description: Bot channel resource definition, - name: ConnectionSetting, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id021 - immediate: - - *id021 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The set of properties specific to bot - channel resource, name: properties } - java: - { description: The set of properties specific to bot channel - resource, name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id278 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: Properties for a Connection Setting - Item, name: ConnectionSettingProperties, namespace: "" } - java: - { - description: Properties for a Connection Setting Item, - name: ConnectionSettingProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Id associated with the Connection - Setting., name: Id } - java: - { - description: Id associated with the Connection Setting., - name: id, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id387 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Id associated with the Connection - Setting., name: ConnectionSettingPropertiesId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Name associated with the Connection - Setting., name: name } - java: { description: Name associated with the Connection - Setting., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id388 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Name associated with the Connection - Setting., name: ConnectionSettingPropertiesName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Client Id associated with the Connection - Setting., name: clientId } - java: - { description: Client Id associated with the Connection - Setting., name: clientId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id389 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - Client Id associated with the Connection - Setting., - name: ConnectionSettingPropertiesClientId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: clientId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Setting Id set by the service for - the Connection Setting., name: settingId } - java: { description: Setting Id set by the service for the - Connection Setting., name: settingId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id390 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Setting Id set by the service for - the Connection Setting., name: ConnectionSettingPropertiesSettingId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: settingId - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Client Secret associated with the - Connection Setting, name: clientSecret } - java: - { - description: - Client Secret associated with the Connection - Setting, - name: clientSecret, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id391 - apiVersions: - - { version: 2021-05-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Client Secret associated with the - Connection Setting, name: ConnectionSettingPropertiesClientSecret } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: clientSecret - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Scopes associated with the Connection - Setting, name: scopes } - java: { description: Scopes associated with the Connection - Setting, name: scopes } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id392 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Scopes associated with the Connection - Setting, name: ConnectionSettingPropertiesScopes } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: scopes - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Service Provider Id associated with - the Connection Setting, name: serviceProviderId } - java: { description: Service Provider Id associated with - the Connection Setting, name: serviceProviderId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id393 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: Service Provider Id associated - with the Connection Setting, name: ConnectionSettingPropertiesServiceProviderId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: serviceProviderId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Service Provider Display Name associated - with the Connection Setting, name: serviceProviderDisplayName } - java: - { description: Service Provider Display Name associated - with the Connection Setting, name: serviceProviderDisplayName } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id394 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: - Service Provider Display Name associated - with the Connection Setting, - name: ConnectionSettingPropertiesServiceProviderDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: serviceProviderDisplayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Service Provider Parameters associated - with the Connection Setting, name: parameters } - java: - { description: Service Provider Parameters associated - with the Connection Setting, name: parameters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id213 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id279 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { description: Extra Parameter in a Connection - Setting Properties to indicate service provider - specific properties, name: ConnectionSettingParameter, namespace: "" } - java: { description: Extra Parameter in a Connection - Setting Properties to indicate service provider - specific properties, name: ConnectionSettingParameter } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Key for the Connection Setting - Parameter., name: key } - java: - { description: Key for the Connection Setting - Parameter., name: key } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id395 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Key for the Connection Setting - Parameter., name: ConnectionSettingParameterKey } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: key - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Value associated with the Connection - Setting Parameter., - name: value, - } - java: - { - description: - Value associated with the Connection - Setting Parameter., - name: value, - } - nullable: true - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id396 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Value associated with the - Connection Setting Parameter., name: ConnectionSettingParameterValue } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: Service Provider Parameters associated - with the Connection Setting, name: ConnectionSettingPropertiesParameters } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: parameters - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Provisioning state of the resource, - name: provisioningState, - } - java: - { - description: Provisioning state of the resource, - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id397 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Provisioning state of the resource, - name: ConnectionSettingPropertiesProvisioningState, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provisioningState - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - - *id044 - - *id045 - - *id046 - - *id047 - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - immediate: - - *id019 - - *id020 - - *id048 - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: { description: Azure resource, name: Resource, namespace: "" } - java: { description: Azure resource, name: Resource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Specifies the resource ID., name: Id } - java: { description: Specifies the resource ID., name: id } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id331 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: Specifies the resource ID., name: ResourceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Specifies the name of the resource., name: name } - java: { description: Specifies the name of the resource., name: name } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id332 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Specifies the name of the resource., - name: ResourceName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Specifies the location of the resource., - name: location, - } - java: - { - description: Specifies the location of the resource., - name: location, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id333 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Specifies the location of the resource., - name: ResourceLocation, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: location - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Specifies the type of the resource., name: type } - java: { description: Specifies the type of the resource., name: type } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id334 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Specifies the type of the resource., - name: ResourceType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Contains resource tags defined as key/value - pairs., name: tags } - java: { description: Contains resource tags defined as key/value - pairs., name: tags } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id258 - apiVersions: [] - elementType: *id049 - language: - default: { description: Contains resource tags defined as key/value - pairs., name: ResourceTags } - java: { description: Contains resource tags defined as key/value - pairs., name: ResourceTags } - protocol: {} - type: DICTIONARY - serializedName: tags - - *id044 - - *id045 - - *id046 - - *id047 - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - immediate: - - *id021 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The set of properties specific to bot resource, - name: properties, - } - java: - { - description: The set of properties specific to bot resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id259 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The parameters to provide for the Bot., - name: BotProperties, - namespace: "", - } - java: - { - description: The parameters to provide for the Bot., - name: BotProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The Name of the bot, name: displayName } - java: { description: The Name of the bot, name: displayName } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id303 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Name of the bot, - name: BotPropertiesDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The description of the bot, name: description } - java: { description: The description of the bot, name: description } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id304 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The description of the bot, - name: BotPropertiesDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The Icon Url of the bot, name: iconUrl } - java: { description: The Icon Url of the bot, name: iconUrl } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id305 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Icon Url of the bot, - name: BotPropertiesIconUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: iconUrl - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The bot's endpoint, name: endpoint } - java: { description: The bot's endpoint, name: endpoint } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id306 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: The bot's endpoint, name: BotPropertiesEndpoint } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: endpoint - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The bot's endpoint version, name: endpointVersion } - java: - { description: The bot's endpoint version, name: endpointVersion } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id307 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The bot's endpoint version, - name: BotPropertiesEndpointVersion, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: endpointVersion - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Contains resource all settings defined as - key/value pairs., name: allSettings } - java: - { description: Contains resource all settings defined as key/value - pairs., name: allSettings } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id256 - apiVersions: [] - elementType: *id049 - language: - default: { description: Contains resource all settings defined - as key/value pairs., name: BotPropertiesAllSettings } - java: { description: Contains resource all settings defined as - key/value pairs., name: BotPropertiesAllSettings } - protocol: {} - type: DICTIONARY - serializedName: allSettings - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Contains resource parameters defined as key/value - pairs., name: parameters } - java: { description: Contains resource parameters defined as key/value - pairs., name: parameters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id257 - apiVersions: [] - elementType: *id049 - language: - default: { description: Contains resource parameters defined as - key/value pairs., name: BotPropertiesParameters } - java: - { description: Contains resource parameters defined as key/value - pairs., name: BotPropertiesParameters } - protocol: {} - type: DICTIONARY - serializedName: parameters - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The bot's manifest url, name: manifestUrl } - java: { description: The bot's manifest url, name: manifestUrl } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id308 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The bot's manifest url, - name: BotPropertiesManifestUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: manifestUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Microsoft App Type for the bot, name: msaAppType } - java: - { description: Microsoft App Type for the bot, name: msaAppType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id246 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: USER_ASSIGNED_MSI } - value: UserAssignedMSI - - language: - default: { description: "", name: SINGLE_TENANT } - value: SingleTenant - - language: - default: { description: "", name: MULTI_TENANT } - value: MultiTenant - language: - default: - { description: Microsoft App Type for the bot, name: MsaAppType } - java: - { description: Microsoft App Type for the bot, name: MsaAppType } - protocol: {} - type: CHOICE - serializedName: msaAppType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Microsoft App Id for the bot, name: msaAppId } - java: { description: Microsoft App Id for the bot, name: msaAppId } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id309 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Microsoft App Id for the bot, - name: BotPropertiesMsaAppId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: msaAppId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Microsoft App Tenant Id for the bot, - name: msaAppTenantId, - } - java: - { - description: Microsoft App Tenant Id for the bot, - name: msaAppTenantId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id310 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Microsoft App Tenant Id for the bot, - name: BotPropertiesMsaAppTenantId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: msaAppTenantId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Microsoft App Managed Identity Resource Id - for the bot, name: msaAppMsiResourceId } - java: { description: Microsoft App Managed Identity Resource Id for - the bot, name: msaAppMsiResourceId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id311 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: Microsoft App Managed Identity Resource - Id for the bot, name: BotPropertiesMsaAppMsiResourceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: msaAppMSIResourceId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Collection of channels for which the bot - is configured, name: configuredChannels } - java: { description: Collection of channels for which the bot is - configured, name: configuredChannels } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id201 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id312 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: "", name: BotPropertiesConfiguredChannelsItem } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: Collection of channels for which the bot - is configured, name: BotPropertiesConfiguredChannels } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: configuredChannels - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Collection of channels for which the bot - is enabled, name: enabledChannels } - java: { description: Collection of channels for which the bot is - enabled, name: enabledChannels } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id202 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id313 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: "", name: BotPropertiesEnabledChannelsItem } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: Collection of channels for which the bot - is enabled, name: BotPropertiesEnabledChannels } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: enabledChannels - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Application Insights key, - name: developerAppInsightKey, - } - java: - { - description: The Application Insights key, - name: developerAppInsightKey, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id314 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Application Insights key, - name: BotPropertiesDeveloperAppInsightKey, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: developerAppInsightKey - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Application Insights Api Key, - name: developerAppInsightsApiKey, - } - java: - { - description: The Application Insights Api Key, - name: developerAppInsightsApiKey, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id315 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Application Insights Api Key, - name: BotPropertiesDeveloperAppInsightsApiKey, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: developerAppInsightsApiKey - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Application Insights App Id, - name: developerAppInsightsApplicationId, - } - java: - { - description: The Application Insights App Id, - name: developerAppInsightsApplicationId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id316 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The Application Insights App Id, - name: BotPropertiesDeveloperAppInsightsApplicationId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: developerAppInsightsApplicationId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Collection of LUIS App Ids, name: luisAppIds } - java: { description: Collection of LUIS App Ids, name: luisAppIds } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id203 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id317 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: "", name: BotPropertiesLuisAppIdsItem } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { - description: Collection of LUIS App Ids, - name: BotPropertiesLuisAppIds, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: luisAppIds - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The LUIS Key, name: luisKey } - java: { description: The LUIS Key, name: luisKey } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id318 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The LUIS Key, name: BotPropertiesLuisKey } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: luisKey - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Whether Cmek is enabled, name: isCmekEnabled } - java: { description: Whether Cmek is enabled, name: isCmekEnabled } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id223 - apiVersions: [] - language: - default: { description: Whether Cmek is enabled, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isCmekEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The CMK Url, name: cmekKeyVaultUrl } - java: { description: The CMK Url, name: cmekKeyVaultUrl } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id319 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: The CMK Url, name: BotPropertiesCmekKeyVaultUrl } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: cmekKeyVaultUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The CMK encryption status, - name: cmekEncryptionStatus, - } - java: - { - description: The CMK encryption status, - name: cmekEncryptionStatus, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id320 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The CMK encryption status, - name: BotPropertiesCmekEncryptionStatus, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: cmekEncryptionStatus - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Whether the bot is in an isolated network, - name: publicNetworkAccess, - } - java: - { - description: Whether the bot is in an isolated network, - name: publicNetworkAccess, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id247 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: ENABLED } - value: Enabled - - language: - default: { description: "", name: DISABLED } - value: Disabled - defaultValue: Enabled - language: - default: - { - description: Whether the bot is in an isolated network, - name: PublicNetworkAccess, - } - java: - { - description: Whether the bot is in an isolated network, - name: PublicNetworkAccess, - } - protocol: {} - type: CHOICE - serializedName: publicNetworkAccess - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Whether the bot is streaming supported, - name: isStreamingSupported, - } - java: - { - description: Whether the bot is streaming supported, - name: isStreamingSupported, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id224 - apiVersions: [] - defaultValue: false - language: - default: - { - description: Whether the bot is streaming supported, - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: isStreamingSupported - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Whether the bot is developerAppInsightsApiKey - set, name: isDeveloperAppInsightsApiKeySet } - java: { description: Whether the bot is developerAppInsightsApiKey - set, name: isDeveloperAppInsightsApiKeySet } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id225 - apiVersions: [] - language: - default: - { description: Whether the bot is developerAppInsightsApiKey - set, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isDeveloperAppInsightsApiKeySet - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Token used to migrate non Azure bot to azure - subscription, name: migrationToken } - java: { description: Token used to migrate non Azure bot to azure - subscription, name: migrationToken } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id321 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: Token used to migrate non Azure bot to - azure subscription, name: BotPropertiesMigrationToken } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: migrationToken - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Opt-out of local authentication and ensure - only MSI and AAD can be used exclusively for authentication., name: disableLocalAuth } - java: { description: Opt-out of local authentication and ensure only - MSI and AAD can be used exclusively for authentication., name: disableLocalAuth } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id050 - serializedName: disableLocalAuth - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The channel schema transformation version - for the bot, name: schemaTransformationVersion } - java: { description: The channel schema transformation version for - the bot, name: schemaTransformationVersion } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id322 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The channel schema transformation version - for the bot, name: BotPropertiesSchemaTransformationVersion } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: schemaTransformationVersion - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The storage resourceId for the bot, - name: storageResourceId, - } - java: - { - description: The storage resourceId for the bot, - name: storageResourceId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id323 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The storage resourceId for the bot, - name: BotPropertiesStorageResourceId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: storageResourceId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: List of Private Endpoint Connections configured - for the bot, name: privateEndpointConnections } - java: { description: List of Private Endpoint Connections configured - for the bot, name: privateEndpointConnections } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id204 - apiVersions: - - { version: 2021-05-01-preview } - elementType: *id012 - language: - default: - { description: List of Private Endpoint Connections configured - for the bot, name: BotPropertiesPrivateEndpointConnections } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: privateEndpointConnections - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The hint to browser (e.g. protocol handler) - on how to open the bot for authoring, name: openWithHint } - java: { description: The hint to browser (e.g. protocol handler) - on how to open the bot for authoring, name: openWithHint } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id327 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The hint to browser (e.g. protocol handler) - on how to open the bot for authoring, name: BotPropertiesOpenWithHint } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: openWithHint - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The hint (e.g. keyVault secret resourceId) - on how to fetch the app secret, name: appPasswordHint } - java: { description: The hint (e.g. keyVault secret resourceId) on - how to fetch the app secret, name: appPasswordHint } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id328 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The hint (e.g. keyVault secret resourceId) - on how to fetch the app secret, name: BotPropertiesAppPasswordHint } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: appPasswordHint - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Provisioning state of the resource, - name: provisioningState, - } - java: - { - description: Provisioning state of the resource, - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id329 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Provisioning state of the resource, - name: BotPropertiesProvisioningState, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Publishing credentials of the resource, - name: publishingCredentials, - } - java: - { - description: Publishing credentials of the resource, - name: publishingCredentials, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id330 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Publishing credentials of the resource, - name: BotPropertiesPublishingCredentials, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: publishingCredentials - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - - *id044 - - *id045 - - *id046 - - *id047 - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id016 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName} - uri: "{$host}" - signatureParameters: - - *id017 - - *id018 - - *id052 - responses: - - language: - default: { description: "If resource is created successfully or already existed, - the service should return 200 (OK).", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id019 - - language: - default: { description: "If resource is created successfully, the service should - return 201 (Created). Execution to continue asynchronously.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id019 - signatureParameters: - - *id017 - - *id018 - - &id053 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: "Error response describing why the operation failed. - If the resource group *or* resource does not exist, 404 (NotFound) should - be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Update Bot: - parameters: - api-version: 2021-05-01-preview - parameters: - etag: etag1 - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - developerAppInsightKey: appinsightskey - developerAppInsightsApiKey: appinsightsapikey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - endpoint: http://mybot.coffee - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - luisKey: luiskey - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - sku: { name: S1 } - tags: { tag1: value1, tag2: value2 } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/UpdateBot.json - responses: - "200": - body: - name: samplebotname - type: Microsoft.BotService/botServices - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - configuredChannels: [facebook, groupme] - developerAppInsightKey: appinsightskey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - enabledChannels: [facebook] - endpoint: http://mybot.coffee - endpointVersion: version - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - tags: { tag1: value1, tag2: value2 } - "201": - body: - name: samplebotname - type: Microsoft.BotService/botServices - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - configuredChannels: [facebook, groupme] - developerAppInsightKey: appinsightskey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - enabledChannels: [facebook] - endpoint: http://mybot.coffee - endpointVersion: version - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - tags: { tag1: value1, tag2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Updates a Bot Service, name: Update } - java: { description: Updates a Bot Service, name: update } - operationGroup: *id015 - operationId: Bots_Update - parameters: - - *id006 - - &id054 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id053 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id055 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id053 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id054 - - *id055 - - *id009 - - *id005 - - &id056 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for the created bot., - name: parameters, - } - java: - { - description: The parameters to provide for the created bot., - name: parameters, - } - nullable: false - operation: *id053 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id019 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id053 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: patch - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName} - uri: "{$host}" - signatureParameters: - - *id054 - - *id055 - - *id056 - responses: - - language: - default: { description: "The resource provider should return 200 (OK) to indicate - that the operation completed successfully. ", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id019 - - language: - default: { description: "If resource is updated successfully, the service should - return 201 (Created). Execution to continue asynchronously.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id019 - signatureParameters: - - *id054 - - *id055 - - &id057 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete Bot: - parameters: - { - api-version: 2021-05-01-preview, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/DeleteBot.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Deletes a Bot Service from the resource group. ", name: Delete } - java: { description: "Deletes a Bot Service from the resource group. ", name: delete } - operationGroup: *id015 - operationId: Bots_Delete - parameters: - - *id006 - - &id058 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id057 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id059 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id057 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id058 - - *id059 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id057 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", - uri: "{$host}", - } - signatureParameters: - - *id058 - - *id059 - responses: - - language: - default: { description: A 200 (OK) should be returned if the object exists - and was deleted successfully;, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: a 204 (NoContent) should be used if the resource does - not exist and the request is well formed., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id058 - - *id059 - - &id060 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: "Error response describing why the operation failed. - If the resource group *or* resource does not exist, 404 (NotFound) should - be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get Bot: - parameters: - { - api-version: 2021-05-01-preview, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetBot.json - responses: - "200": - body: - name: samplebotname - type: Microsoft.BotService/botServices - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - configuredChannels: [facebook, groupme] - developerAppInsightKey: appinsightskey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - enabledChannels: [facebook] - endpoint: http://mybot.coffee - endpointVersion: version - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - privateEndpointConnections: - - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname/privateEndpointConnections/privatelink - properties: - privateEndpoint: - { - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.Network/privateEndpoints/privatelink, - } - privateLinkServiceConnectionState: - { - description: Auto-Approved, - actionsRequired: None, - status: Approved, - } - provisioningState: Succeeded - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - tags: { tag1: value1, tag2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Returns a BotService specified by the parameters., name: Get } - java: - { - description: Returns a BotService specified by the parameters., - name: getByResourceGroup, - } - operationGroup: *id015 - operationId: Bots_Get - parameters: - - *id006 - - &id061 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id060 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id062 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id060 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id061 - - *id062 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id060 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}", - uri: "{$host}", - } - signatureParameters: - - *id061 - - *id062 - responses: - - language: - default: { description: "The resource provider should return 200 (OK) to indicate - that the operation completed successfully. ", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id019 - signatureParameters: - - *id061 - - *id062 - - &id068 - apiVersions: &id063 - - { version: 2021-05-01-preview } - exceptions: &id064 - - language: - default: { description: "Error response describing why the operation failed. - If the resource group does not exist, 404 (NotFound) will be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: &id065 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Bots by Resource Group: - parameters: - { - api-version: 2021-05-01-preview, - resourceGroupName: OneResourceGroupName, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListBotsByResourceGroup.json - responses: - "200": - body: - value: - - name: samplebotname - type: Microsoft.BotService/botServices - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - configuredChannels: [facebook, groupme] - developerAppInsightKey: appinsightskey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - enabledChannels: [facebook] - endpoint: http://mybot.coffee - endpointVersion: version - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - tags: { tag1: value1, tag2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id067 - $key: listByResourceGroupNext - apiVersions: *id063 - exceptions: *id064 - extensions: *id065 - language: - java: { description: Get the next page of items, name: listByResourceGroupNext } - operationGroup: *id015 - parameters: [] - requests: - - language: &id070 - default: { description: Returns all the resources of a particular type - belonging to a resource group, name: ListByResourceGroup } - java: { description: Returns all the resources of a particular type belonging - to a resource group, name: listByResourceGroup } - parameters: - - &id069 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id066 { name: nextLink, serializedName: nextLink } - java: *id066 - nullable: false - operation: *id067 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id006 - - &id072 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id068 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id069 - responses: &id073 - - language: - default: - description: "The resource provider should return 200 (OK) to indicate\ - \ that the operation completed successfully. For other errors (e.g.\ - \ internal errors) use the appropriate HTTP error code.\nThe nextLink\ - \ field is expected to point to the URL the client should use to\ - \ fetch the next page (per server side paging). This matches the\ - \ OData guidelines for paged responses here. If a resource provider\ - \ does not support paging, it should return the same body (JSON\ - \ object with “value” property) but omit nextLink entirely (or set\ - \ to null, *not* empty string) for future compatibility.\nThe nextLink\ - \ should be implemented using following query parameters:\n· skipToken:\ - \ opaque token that allows the resource provider to skip resources\ - \ already enumerated. This value is defined and returned by the\ - \ RP after first request via nextLink.\n· top: the optional client\ - \ query parameter which defines the maximum number of records to\ - \ be returned by the server.\nImplementation details:\n· NextLink\ - \ may include all the query parameters (specifically OData $filter)\ - \ used by the client in the first query. \n· Server may return less\ - \ records than requested with nextLink. Returning zero records with\ - \ NextLink is an acceptable response. \nClients must fetch records\ - \ until the nextLink is not returned back / null. Clients should\ - \ never rely on number of returned records to determinate if pagination\ - \ is completed." - name: "" - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id081 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The list of bot service operation response., - name: BotResponseList, - namespace: "", - } - java: - { - description: The list of bot service operation response., - name: BotResponseList, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The link used to get the next page of bot - service resources., name: nextLink } - java: { description: The link used to get the next page of bot service - resources., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id339 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The link used to get the next page of bot - service resources., name: BotResponseListNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the list of bot service results and - their properties., name: value } - java: { description: Gets the list of bot service results and their - properties., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id206 - apiVersions: - - { version: 2021-05-01-preview } - elementType: *id019 - language: - default: { description: Gets the list of bot service results and - their properties., name: BotResponseListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id070 - operationGroup: *id015 - operationId: Bots_ListByResourceGroup - parameters: - - *id006 - - &id071 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id068 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id005 - - *id009 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id071 - - *id005 - - *id009 - - *id072 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices", - uri: "{$host}", - } - signatureParameters: - - *id071 - responses: *id073 - signatureParameters: - - *id071 - - &id079 - apiVersions: &id074 - - { version: 2021-05-01-preview } - exceptions: &id075 - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: &id076 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Bots by Subscription: - parameters: { api-version: 2021-05-01-preview, subscriptionId: subscription-id } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListBotsBySubscription.json - responses: - "200": - body: - value: - - name: samplebotname - type: Microsoft.BotService/botServices - etag: etag1 - id: /subscriptions/subscription-id/providers/Microsoft.BotService/botServices - kind: sdk - location: West US - properties: - description: The description of the bot - cmekKeyVaultUrl: https://myCmekKey - configuredChannels: [facebook, groupme] - developerAppInsightKey: appinsightskey - developerAppInsightsApplicationId: appinsightsappid - disableLocalAuth: true - displayName: The Name of the bot - enabledChannels: [facebook] - endpoint: http://mybot.coffee - endpointVersion: version - iconUrl: http://myicon - isCmekEnabled: true - luisAppIds: [luisappid1, luisappid2] - msaAppId: msaappid - msaAppMSIResourceId: /subscriptions/foo/resourcegroups/bar/providers/microsoft.managedidentity/userassignedidentities/sampleId - msaAppTenantId: msaapptenantid - msaAppType: UserAssignedMSI - publicNetworkAccess: Enabled - schemaTransformationVersion: "1.0" - tags: { tag1: value1, tag2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id078 - $key: listNext - apiVersions: *id074 - exceptions: *id075 - extensions: *id076 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id015 - parameters: [] - requests: - - language: &id082 - default: { description: Returns all the resources of a particular type - belonging to a subscription., name: List } - java: { description: Returns all the resources of a particular type belonging - to a subscription., name: list } - parameters: - - &id080 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id077 { name: nextLink, serializedName: nextLink } - java: *id077 - nullable: false - operation: *id078 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id006 - - &id083 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id079 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id080 - responses: &id084 - - language: - default: - description: "The resource provider should return 200 (OK) to indicate\ - \ that the operation completed successfully. For other errors (e.g.\ - \ internal errors) use the appropriate HTTP error code.\nThe nextLink\ - \ field is expected to point to the URL the client should use to\ - \ fetch the next page (per server side paging). This matches the\ - \ OData guidelines for paged responses. If a resource provider does\ - \ not support paging, it should return the same body but leave nextLink\ - \ empty for future compatibility.\nFor a detailed explanation of\ - \ each field in the response body, please refer to the request body\ - \ description in the PUT resource section. " - name: "" - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id081 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id082 - operationGroup: *id015 - operationId: Bots_List - parameters: - - *id006 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id009 - - *id005 - - *id083 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/botServices", - uri: "{$host}", - } - signatureParameters: [] - responses: *id084 - signatureParameters: [] - - &id085 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - check Name Availability: - parameters: - api-version: 2021-05-01-preview - parameters: { name: testbotname, type: string } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/CheckNameAvailability.json - responses: - "200": - body: { message: custom message from server, valid: true } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { description: Check whether a bot name is available., name: GetCheckNameAvailability } - java: - { description: Check whether a bot name is available., name: getCheckNameAvailability } - operationGroup: *id015 - operationId: Bots_GetCheckNameAvailability - parameters: - - *id006 - - *id009 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id009 - - &id086 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The request body parameters to provide for the check - name availability request, name: parameters } - java: { description: The request body parameters to provide for the check - name availability request, name: parameters } - nullable: false - operation: *id085 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id267 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The request body for a request to Bot Service Management - to check availability of a bot name., name: CheckNameAvailabilityRequestBody, namespace: "" } - java: { description: The request body for a request to Bot Service Management - to check availability of a bot name., name: CheckNameAvailabilityRequestBody } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: the name of the bot for which availability needs - to be checked., name: name } - java: { description: the name of the bot for which availability needs - to be checked., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id365 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: the name of the bot for which availability - needs to be checked., name: CheckNameAvailabilityRequestBodyName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: the type of the bot for which availability needs - to be checked, name: type } - java: { description: the type of the bot for which availability needs - to be checked, name: type } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id366 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: the type of the bot for which availability - needs to be checked, name: CheckNameAvailabilityRequestBodyType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id085 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /providers/Microsoft.BotService/checkNameAvailability - uri: "{$host}" - signatureParameters: - - *id086 - responses: - - language: - default: - description: "The resource provider should return 200 (OK) to indicate that\ - \ the operation completed successfully. For other errors (e.g. internal\ - \ errors) use the appropriate HTTP error code.\nThe nextLink field is\ - \ expected to point to the URL the client should use to fetch the next\ - \ page (per server side paging). This matches the OData guidelines for\ - \ paged responses. If a resource provider does not support paging, it\ - \ should return the same body but leave nextLink empty for future compatibility.\n\ - For a detailed explanation of each field in the response body, please\ - \ refer to the request body description in the PUT resource section. " - name: "" - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id268 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The response body returned for a request to Bot Service - Management to check availability of a bot name., name: CheckNameAvailabilityResponseBody, namespace: "" } - java: { description: The response body returned for a request to Bot Service - Management to check availability of a bot name., name: CheckNameAvailabilityResponseBody } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: indicates if the bot name is valid., name: valid } - java: { description: indicates if the bot name is valid., name: valid } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id232 - apiVersions: [] - language: - default: { description: indicates if the bot name is valid., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: valid - - apiVersions: [] - isDiscriminator: false - language: - default: { description: additional message from the bot management api - showing why a bot name is not available, name: message } - java: { description: additional message from the bot management api showing - why a bot name is not available, name: message } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id367 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: additional message from the bot management api - showing why a bot name is not available, name: CheckNameAvailabilityResponseBodyMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - - *id067 - - *id078 - protocol: {} - - &id087 - $key: Channels - codeModel: *id001 - language: - default: { description: "", name: Channels } - java: { description: "", name: Channels } - operations: - - &id088 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create DirectLine Speech Bot: - parameters: - api-version: 2021-05-01-preview - channelName: DirectLineSpeechChannel - parameters: - location: global - properties: - channelName: DirectLineSpeechChannel - properties: - { - cognitiveServiceRegion: XcognitiveServiceRegionX, - cognitiveServiceSubscriptionKey: XcognitiveServiceSubscriptionKeyX, - isEnabled: true, - } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/PutDirectLineSpeechChannel.json - responses: - "200": - body: - location: global - properties: - channelName: DirectLineSpeechChannel - properties: - { cognitiveServiceRegion: XcognitiveServiceRegionX, isEnabled: true } - "201": - body: - location: global - properties: - channelName: DirectLineSpeechChannel - properties: - { cognitiveServiceRegion: XcognitiveServiceRegionX, isEnabled: true } - Create Bot: - parameters: - api-version: 2021-05-01-preview - channelName: EmailChannel - parameters: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/PutChannel.json - responses: - "200": - body: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - "201": - body: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - Create Alexa Bot: - parameters: - api-version: 2021-05-01-preview - channelName: AlexaChannel - parameters: - location: global - properties: - channelName: AlexaChannel - properties: { alexaSkillId: XAlexaSkillIdX, isEnabled: true } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/PutAlexaChannel.json - responses: - "200": - body: - location: global - properties: - channelName: AlexaChannel - properties: - { - alexaSkillId: alexa skill id, - isEnabled: true, - serviceEndpointUri: "https://domain/XUrlFragmentX/botId", - urlFragment: XUrlFragmentX, - } - "201": - body: - location: global - properties: - channelName: AlexaChannel - properties: - { - alexaSkillId: alexa skill id, - isEnabled: true, - serviceEndpointUri: "https://domain/XUrlFragmentX/botId", - urlFragment: XUrlFragmentX, - } - Create Line Bot: - parameters: - api-version: 2021-05-01-preview - channelName: LineChannel - parameters: - location: global - properties: - channelName: LineChannel - properties: - lineRegistrations: - - { channelAccessToken: channelAccessToken, channelSecret: channelSecret } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/PutLineChannel.json - responses: - "200": - body: - location: global - properties: - channelName: LineChannel - properties: - callbackUrl: http://callbackUrl - isValidated: true - lineRegistrations: - - { channelAccessToken: null, channelSecret: null, generatedId: id } - "201": - body: - location: global - properties: - channelName: LineChannel - properties: - callbackUrl: http://callbackUrl - isValidated: true - lineRegistrations: - - { channelAccessToken: null, channelSecret: null, generatedId: id } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Creates a Channel registration for a Bot Service, name: Create } - java: { description: Creates a Channel registration for a Bot Service, name: create } - operationGroup: *id087 - operationId: Channels_Create - parameters: - - *id006 - - &id089 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id088 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id090 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id088 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id091 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Channel resource., - name: channelName, - serializedName: channelName, - } - java: - { - description: The name of the Channel resource., - name: channelName, - serializedName: channelName, - } - nullable: false - operation: *id088 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id094 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: ALEXA_CHANNEL } - value: AlexaChannel - - language: - default: { description: "", name: FACEBOOK_CHANNEL } - value: FacebookChannel - - language: - default: { description: "", name: EMAIL_CHANNEL } - value: EmailChannel - - language: - default: { description: "", name: KIK_CHANNEL } - value: KikChannel - - language: - default: { description: "", name: TELEGRAM_CHANNEL } - value: TelegramChannel - - language: - default: { description: "", name: SLACK_CHANNEL } - value: SlackChannel - - language: - default: { description: "", name: MS_TEAMS_CHANNEL } - value: MsTeamsChannel - - language: - default: { description: "", name: SKYPE_CHANNEL } - value: SkypeChannel - - language: - default: { description: "", name: WEB_CHAT_CHANNEL } - value: WebChatChannel - - language: - default: { description: "", name: DIRECT_LINE_CHANNEL } - value: DirectLineChannel - - language: - default: { description: "", name: SMS_CHANNEL } - value: SmsChannel - - language: - default: { description: "", name: LINE_CHANNEL } - value: LineChannel - - language: - default: { description: "", name: DIRECT_LINE_SPEECH_CHANNEL } - value: DirectLineSpeechChannel - - language: - default: { description: "", name: OUTLOOK_CHANNEL } - value: OutlookChannel - language: - default: { description: "", name: ChannelName } - java: { description: "", name: ChannelName } - protocol: {} - type: SEALED_CHOICE - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id089 - - *id090 - - *id091 - - *id009 - - *id005 - - &id092 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for the created bot., - name: parameters, - } - java: - { - description: The parameters to provide for the created bot., - name: parameters, - } - nullable: false - operation: *id088 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id020 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id088 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName} - uri: "{$host}" - signatureParameters: - - *id089 - - *id090 - - *id091 - - *id092 - responses: - - language: - default: { description: "If resource is created successfully or already existed, - the service should return 200 (OK).", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id020 - - language: - default: { description: "If resource is created successfully, the service should - return 201 (Created). Execution to continue asynchronously.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id020 - signatureParameters: - - *id089 - - *id090 - - *id091 - - &id093 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: "Error response describing why the operation failed. - If the resource group *or* resource does not exist, 404 (NotFound) should - be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Update DirectLine Speech: - parameters: - api-version: 2021-05-01-preview - channelName: DirectLineSpeechChannel - parameters: - location: global - properties: - channelName: DirectLineSpeechChannel - properties: - { - cognitiveServiceRegion: XcognitiveServiceRegionX, - cognitiveServiceSubscriptionKey: XcognitiveServiceSubscriptionKeyX, - isEnabled: true, - } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/UpdateDirectLineSpeechChannel.json - responses: - "200": - body: - location: global - properties: - channelName: DirectLineSpeechChannel - properties: - { cognitiveServiceRegion: XcognitiveServiceRegionX, isEnabled: true } - "201": - body: - location: global - properties: - channelName: DirectLineSpeechChannel - properties: - { cognitiveServiceRegion: XcognitiveServiceRegionX, isEnabled: true } - Update Bot: - parameters: - api-version: 2021-05-01-preview - channelName: EmailChannel - parameters: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/UpdateChannel.json - responses: - "200": - body: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - "201": - body: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - Update Line: - parameters: - api-version: 2021-05-01-preview - channelName: LineChannel - parameters: - location: global - properties: - channelName: LineChannel - properties: - lineRegistrations: - - { channelAccessToken: channelAccessToken, channelSecret: channelSecret } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/UpdateLineChannel.json - responses: - "200": - body: - location: global - properties: - channelName: LineChannel - properties: - callbackUrl: http://callbackUrl - isValidated: true - lineRegistrations: - - { channelAccessToken: null, channelSecret: null, generatedId: id } - "201": - body: - location: global - properties: - channelName: LineChannel - properties: - callbackUrl: http://callbackUrl - isValidated: true - lineRegistrations: - - { channelAccessToken: null, channelSecret: null, generatedId: id } - Update Alexa: - parameters: - api-version: 2021-05-01-preview - channelName: AlexaChannel - parameters: - location: global - properties: - channelName: AlexaChannel - properties: { alexaSkillId: XAlexaSkillIdX, isEnabled: true } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/UpdateAlexaChannel.json - responses: - "200": - body: - location: global - properties: - channelName: AlexaChannel - properties: - { - alexaSkillId: XAlexaSkillIdX, - isEnabled: true, - serviceEndpointUri: "https://domain/XUrlFragmentX/botId", - urlFragment: XUrlFragmentX, - } - "201": - body: - location: global - properties: - channelName: AlexaChannel - properties: - { - alexaSkillId: XAlexaSkillIdX, - isEnabled: true, - serviceEndpointUri: "https://domain/XUrlFragmentX/botId", - urlFragment: XUrlFragmentX, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Updates a Channel registration for a Bot Service, name: Update } - java: { description: Updates a Channel registration for a Bot Service, name: update } - operationGroup: *id087 - operationId: Channels_Update - parameters: - - *id006 - - &id095 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id096 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id097 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Channel resource., - name: channelName, - serializedName: channelName, - } - java: - { - description: The name of the Channel resource., - name: channelName, - serializedName: channelName, - } - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id094 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id095 - - *id096 - - *id097 - - *id009 - - *id005 - - &id098 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for the created bot., - name: parameters, - } - java: - { - description: The parameters to provide for the created bot., - name: parameters, - } - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id020 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id093 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: patch - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName} - uri: "{$host}" - signatureParameters: - - *id095 - - *id096 - - *id097 - - *id098 - responses: - - language: - default: { description: "The resource provider should return 200 (OK) to indicate - that the operation completed successfully. ", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id020 - - language: - default: { description: "If resource is updated successfully, the service should - return 201 (Created). Execution to continue asynchronously.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id020 - signatureParameters: - - *id095 - - *id096 - - *id097 - - &id099 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete Bot: - parameters: - { - api-version: 2021-05-01-preview, - channelName: EmailChannel, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/DeleteChannel.json - responses: - "200": {} - "204": {} - Delete DirectLine Speech Bot: - parameters: - { - api-version: 2021-05-01-preview, - channelName: DirectLineSpeechChannel, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/DeleteDirectLineSpeechChannel.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes a Channel registration from a Bot Service, name: Delete } - java: { description: Deletes a Channel registration from a Bot Service, name: delete } - operationGroup: *id087 - operationId: Channels_Delete - parameters: - - *id006 - - &id100 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id099 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id101 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id099 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id102 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: channelName, - serializedName: channelName, - } - java: - { - description: The name of the Bot resource., - name: channelName, - serializedName: channelName, - } - nullable: false - operation: *id099 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id100 - - *id101 - - *id102 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id099 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", - uri: "{$host}", - } - signatureParameters: - - *id100 - - *id101 - - *id102 - responses: - - language: - default: { description: A 200 (OK) should be returned if the object exists - and was deleted successfully;, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: a 204 (NoContent) should be used if the resource does - not exist and the request is well formed., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id100 - - *id101 - - *id102 - - &id103 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: "Error response describing why the operation failed. - If the resource group *or* resource does not exist, 404 (NotFound) should - be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get DirectLine Speech Bot: - parameters: - { - api-version: 2021-05-01-preview, - channelName: DirectLineSpeechChannel, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetDirectLineSpeechChannel.json - responses: - "200": - body: - location: global - properties: - channelName: DirectLineSpeechChannel - properties: - { - cognitiveServiceRegion: Cognitive service region, - customSpeechModelId: Custom speech model ID, - customVoiceDeploymentId: Custom - voice deployment ID, - isDefaultBotForCogSvcAccount: true, - isEnabled: true, - } - Get Line Bot: - parameters: - { - api-version: 2021-05-01-preview, - channelName: LineChannel, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetLineChannel.json - responses: - "200": - body: - location: global - properties: - channelName: LineChannel - properties: - callbackUrl: http://callbackUrl - isValidated: true - lineRegistrations: - - { channelAccessToken: null, channelSecret: null, generatedId: id } - Get Bot: - parameters: - { - api-version: 2021-05-01-preview, - channelName: EmailChannel, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetChannel.json - responses: - "200": - body: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - Get Alexa Bot: - parameters: - { - api-version: 2021-05-01-preview, - channelName: AlexaChannel, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetAlexaChannel.json - responses: - "200": - body: - location: global - properties: - channelName: AlexaChannel - properties: - { - alexaSkillId: alexa skill id, - isEnabled: true, - serviceEndpointUri: "https://domain/XUrlFragmentX/botId", - urlFragment: XUrlFragmentX, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Returns a BotService Channel registration specified by - the parameters., name: Get } - java: { description: Returns a BotService Channel registration specified by the - parameters., name: get } - operationGroup: *id087 - operationId: Channels_Get - parameters: - - *id006 - - &id104 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id103 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id105 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id103 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id106 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: channelName, - serializedName: channelName, - } - java: - { - description: The name of the Bot resource., - name: channelName, - serializedName: channelName, - } - nullable: false - operation: *id103 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id104 - - *id105 - - *id106 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id103 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}", - uri: "{$host}", - } - signatureParameters: - - *id104 - - *id105 - - *id106 - responses: - - language: - default: { description: "The resource provider should return 200 (OK) to indicate - that the operation completed successfully. ", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id020 - signatureParameters: - - *id104 - - *id105 - - *id106 - - &id107 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Channel: - parameters: - api-version: 2021-05-01-preview - channelName: EmailChannel - parameters: { location: global } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListChannel.json - responses: - "200": - body: - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - resource: - channelName: DirectLineChannel - etag: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - location: aaaaaa - properties: - sites: - - isBlockUserUploadEnabled: false - isEnabled: true - isSecureSiteEnabled: false - isV1Enabled: true - isV3Enabled: true - key: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - key2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - siteId: aaaaaaaaaaa - siteName: aaaaaaaaaaaa - trustedOrigins: - [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] - setting: - botIconUrl: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - botId: aaaaaaaaaaaaaaaaaaaa - channelDisplayName: aaaaaaaaaaa - channelId: aaaaaaaaaa - disableLocalAuth: false - extensionKey1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - extensionKey2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - isEnabled: true - sites: - - eTag: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - isBlockUserUploadEnabled: false - isEnabled: true - isSecureSiteEnabled: false - isTokenEnabled: false - isV1Enabled: true - isV3Enabled: true - isWebchatPreviewEnabled: false - key: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - key2: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - siteId: aaaaaaaaaaa - siteName: aaaaaaaaaaaa - trustedOrigins: - [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Lists a Channel registration for a Bot Service including - secrets, name: ListWithKeys } - java: { description: Lists a Channel registration for a Bot Service including - secrets, name: listWithKeys } - operationGroup: *id087 - operationId: Channels_ListWithKeys - parameters: - - *id006 - - &id108 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id107 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id109 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id107 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id110 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Channel resource., - name: channelName, - serializedName: channelName, - } - java: - { - description: The name of the Channel resource., - name: channelName, - serializedName: channelName, - } - nullable: false - operation: *id107 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id094 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id108 - - *id109 - - *id110 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id107 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/listChannelWithKeys", - uri: "{$host}", - } - signatureParameters: - - *id108 - - *id109 - - *id110 - responses: - - language: - default: { description: "If resource is retrieved successfully, the service - should return 200 (OK).", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id043 - signatureParameters: - - *id108 - - *id109 - - *id110 - - &id116 - apiVersions: &id111 - - { version: 2021-05-01-preview } - exceptions: &id112 - - language: - default: { description: "Error response describing why the operation failed. - If the resource group does not exist, 404 (NotFound) will be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: &id113 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Bots by Resource Group: - parameters: - { - api-version: 2021-05-01-preview, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListChannelsByBotService.json - responses: - "200": - body: - value: - - location: global - properties: - channelName: EmailChannel - properties: { emailAddress: a@b.com, isEnabled: true, password: pwd } - - location: global - properties: - channelName: FacebookChannel - properties: - appId: id - callbackUrl: appid - isEnabled: true - pages: - - { accessToken: null, id: id } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id115 - $key: listByResourceGroupNext - apiVersions: *id111 - exceptions: *id112 - extensions: *id113 - language: - java: { description: Get the next page of items, name: listByResourceGroupNext } - operationGroup: *id087 - parameters: [] - requests: - - language: &id118 - default: { description: Returns all the Channel registrations of a particular - BotService resource, name: ListByResourceGroup } - java: { description: Returns all the Channel registrations of a particular - BotService resource, name: listByResourceGroup } - parameters: - - &id117 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id114 { name: nextLink, serializedName: nextLink } - java: *id114 - nullable: false - operation: *id115 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id006 - - &id121 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id116 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id117 - responses: &id122 - - language: - default: - description: "The resource provider should return 200 (OK) to indicate\ - \ that the operation completed successfully. For other errors (e.g.\ - \ internal errors) use the appropriate HTTP error code.\nThe nextLink\ - \ field is expected to point to the URL the client should use to\ - \ fetch the next page (per server side paging). This matches the\ - \ OData guidelines for paged responses here. If a resource provider\ - \ does not support paging, it should return the same body (JSON\ - \ object with “value” property) but omit nextLink entirely (or set\ - \ to null, *not* empty string) for future compatibility.\nThe nextLink\ - \ should be implemented using following query parameters:\n· skipToken:\ - \ opaque token that allows the resource provider to skip resources\ - \ already enumerated. This value is defined and returned by the\ - \ RP after first request via nextLink.\n· top: the optional client\ - \ query parameter which defines the maximum number of records to\ - \ be returned by the server.\nImplementation details:\n· NextLink\ - \ may include all the query parameters (specifically OData $filter)\ - \ used by the client in the first query. \n· Server may return less\ - \ records than requested with nextLink. Returning zero records with\ - \ NextLink is an acceptable response. \nClients must fetch records\ - \ until the nextLink is not returned back / null. Clients should\ - \ never rely on number of returned records to determinate if pagination\ - \ is completed." - name: "" - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id265 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The list of bot service channel operation response., - name: ChannelResponseList, - namespace: "", - } - java: - { - description: The list of bot service channel operation response., - name: ChannelResponseList, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The link used to get the next page of bot - service channel resources., name: nextLink } - java: { description: The link used to get the next page of bot service - channel resources., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id363 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The link used to get the next page of bot - service channel resources., name: ChannelResponseListNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the list of bot service channel results - and their properties., name: value } - java: { description: Gets the list of bot service channel results - and their properties., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id209 - apiVersions: - - { version: 2021-05-01-preview } - elementType: *id020 - language: - default: { description: Gets the list of bot service channel results - and their properties., name: ChannelResponseListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id118 - operationGroup: *id087 - operationId: Channels_ListByResourceGroup - parameters: - - *id006 - - &id119 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id116 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id120 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id116 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id005 - - *id009 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id119 - - *id120 - - *id005 - - *id009 - - *id121 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels", - uri: "{$host}", - } - signatureParameters: - - *id119 - - *id120 - responses: *id122 - signatureParameters: - - *id119 - - *id120 - - *id115 - protocol: {} - - &id123 - $key: DirectLine - codeModel: *id001 - language: - default: { description: "", name: DirectLine } - java: { description: "", name: DirectLine } - operations: - - &id124 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: "Error response describing why the operation failed. - If the resource group does not exist, 404 (NotFound) will be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Regenerate Keys for DirectLine Channel Site: - parameters: - api-version: 2021-05-01-preview - channelName: DirectLineChannel - parameters: { key: key1, siteName: testSiteName } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/DirectlineRegenerateKeys.json - responses: - "200": - body: - location: global - properties: - channelName: DirectLineChannel - properties: - sites: - - { - isEnabled: true, - isV1Enabled: true, - isV3Enabled: true, - key: key1, - key2: key2, - siteId: abcd, - siteName: Default Site, - } - Regenerate Keys for WebChat Channel Site: - parameters: - api-version: 2021-05-01-preview - channelName: WebChatChannel - parameters: { key: key1, siteName: testSiteName } - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/WebChatRegenerateKeys.json - responses: - "200": - body: - location: global - properties: - channelName: WebChatChannel - properties: - sites: - - { - isEnabled: true, - isWebchatPreviewEnabled: true, - key: key1, - key2: key2, - siteId: abcd, - siteName: Default Site, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Regenerates secret keys and returns them for the DirectLine - Channel of a particular BotService resource, name: RegenerateKeys } - java: { description: Regenerates secret keys and returns them for the DirectLine - Channel of a particular BotService resource, name: regenerateKeys } - operationGroup: *id123 - operationId: DirectLine_RegenerateKeys - parameters: - - *id006 - - &id125 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id124 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id126 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id124 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id005 - - &id127 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the Channel resource for which keys are - to be regenerated., name: channelName, serializedName: channelName } - java: { description: The name of the Channel resource for which keys are to - be regenerated., name: channelName, serializedName: channelName } - nullable: false - operation: *id124 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id301 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: WEB_CHAT_CHANNEL } - value: WebChatChannel - - language: - default: { description: "", name: DIRECT_LINE_CHANNEL } - value: DirectLineChannel - language: - default: { description: "", name: RegenerateKeysChannelName } - java: { description: "", name: RegenerateKeysChannelName } - protocol: {} - type: SEALED_CHOICE - - *id009 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id125 - - *id126 - - *id005 - - *id127 - - *id009 - - &id128 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for the created bot., - name: parameters, - } - java: - { - description: The parameters to provide for the created bot., - name: parameters, - } - nullable: false - operation: *id124 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id266 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: Site information for WebChat or DirectLine Channels - to identify which site to regenerate keys for., name: SiteInfo, namespace: "" } - java: { description: Site information for WebChat or DirectLine Channels - to identify which site to regenerate keys for., name: SiteInfo } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The site name, name: siteName } - java: { description: The site name, name: siteName } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id364 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The site name, name: SiteInfoSiteName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: siteName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Determines which key is to be regenerated, name: key } - java: { description: Determines which key is to be regenerated, name: key } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id302 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: KEY1 } - value: key1 - - language: - default: { description: "", name: KEY2 } - value: key2 - language: - default: - { description: Determines which key is to be regenerated, name: Key } - java: - { description: Determines which key is to be regenerated, name: Key } - protocol: {} - type: SEALED_CHOICE - serializedName: key - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id124 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/channels/{channelName}/regeneratekeys - uri: "{$host}" - signatureParameters: - - *id125 - - *id126 - - *id127 - - *id128 - responses: - - language: - default: - description: "The resource provider should return 200 (OK) to indicate that\ - \ the operation completed successfully. For other errors (e.g. internal\ - \ errors) use the appropriate HTTP error code.\nThe nextLink field is\ - \ expected to point to the URL the client should use to fetch the next\ - \ page (per server side paging). This matches the OData guidelines for\ - \ paged responses here. If a resource provider does not support paging,\ - \ it should return the same body (JSON object with “value” property) but\ - \ omit nextLink entirely (or set to null, *not* empty string) for future\ - \ compatibility.\nThe nextLink should be implemented using following query\ - \ parameters:\n· skipToken: opaque token that allows the resource provider\ - \ to skip resources already enumerated. This value is defined and returned\ - \ by the RP after first request via nextLink.\n· top: the optional client\ - \ query parameter which defines the maximum number of records to be returned\ - \ by the server.\nImplementation details:\n· NextLink may include all\ - \ the query parameters (specifically OData $filter) used by the client\ - \ in the first query. \n· Server may return less records than requested\ - \ with nextLink. Returning zero records with NextLink is an acceptable\ - \ response. \nClients must fetch records until the nextLink is not returned\ - \ back / null. Clients should never rely on number of returned records\ - \ to determinate if pagination is completed." - name: "" - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id020 - signatureParameters: - - *id125 - - *id126 - - *id127 - protocol: {} - - &id132 - $key: Operations - codeModel: *id001 - language: - default: { description: "", name: Operations } - java: { description: "", name: Operations } - operations: - - &id135 - apiVersions: &id129 - - { version: 2021-05-01-preview } - exceptions: &id130 - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: &id131 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get Operations: - parameters: { api-version: 2021-05-01-preview } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetOperations.json - responses: - "200": - body: - value: - - name: Microsoft.BotService/botService/read - display: - { - description: Read Bot Service, - operation: Read Bot Service, - provider: Microsoft Bot Service, - resource: Bot Service, - } - origin: user,system - - name: Microsoft.BotService/botService/write - display: { description: Writes Bot Service, operation: Write Bot - Service, provider: Microsoft Bot Service, resource: Bot Service } - origin: user,system - - name: Microsoft.BotService/botService/delete - display: { description: Deletes Bot Service, operation: Delete - Bot Service, provider: Microsoft Bot Service, resource: Bot - Service } - origin: user,system - - name: Microsoft.BotService/botService/botName/read - display: { description: Check bot name availability, operation: Check - bot name availability, provider: Microsoft Bot Service, resource: Bot - Service name availability } - origin: user,system - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id134 - $key: listNext - apiVersions: *id129 - exceptions: *id130 - extensions: *id131 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id132 - parameters: [] - requests: - - language: &id137 - default: - { description: Lists all the available BotService operations., name: List } - java: - { description: Lists all the available BotService operations., name: list } - parameters: - - &id136 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id133 { name: nextLink, serializedName: nextLink } - java: *id133 - nullable: false - operation: *id134 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id006 - - &id138 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id135 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id136 - responses: &id139 - - language: - default: { description: OK., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id269 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The list of bot service operation response., - name: OperationEntityListResult, - namespace: "", - } - java: - { - description: The list of bot service operation response., - name: OperationEntityListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The link used to get the next page of operations., - name: nextLink, - } - java: - { - description: The link used to get the next page of operations., - name: nextLink, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id368 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The link used to get the next page of operations., - name: OperationEntityListResultNextLink, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The list of operations., name: value } - java: { description: The list of operations., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id210 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id270 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The operations supported by Bot Service - Management., name: OperationEntity, namespace: "" } - java: { description: The operations supported by Bot Service - Management., name: OperationEntity } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: "Operation name: {provider}/{resource}/{operation}.", - name: name, - } - java: - { - description: "Operation name: {provider}/{resource}/{operation}.", - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id369 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: "Operation name: {provider}/{resource}/{operation}.", - name: OperationEntityName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The operation supported by Bot Service - Management., name: display } - java: { description: The operation supported by Bot Service - Management., name: display } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id271 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The operation supported by Bot Service - Management., name: OperationDisplayInfo, namespace: "" } - java: { description: The operation supported by Bot Service - Management., name: OperationDisplayInfo } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The description of the operation., - name: description, - } - java: - { - description: The description of the operation., - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id370 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The description of the operation., - name: OperationDisplayInfoDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The action that users can perform, - based on their permission level.", name: operation } - java: { description: "The action that users can perform, - based on their permission level.", name: operation } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id371 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { description: "The action that users can perform, - based on their permission level.", name: OperationDisplayInfoOperation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: operation - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Service provider: Microsoft Bot - Service.", name: provider } - java: - { - description: "Service provider: Microsoft Bot Service.", - name: provider, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id372 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: "Service provider: Microsoft - Bot Service.", name: OperationDisplayInfoProvider } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provider - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Resource on which the operation - is performed., name: resource } - java: { description: Resource on which the operation is - performed., name: resource } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id373 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: Resource on which the operation - is performed., name: OperationDisplayInfoResource } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resource - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: display - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The origin of the operation., name: origin } - java: { description: The origin of the operation., name: origin } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id374 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The origin of the operation., - name: OperationEntityOrigin, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: origin - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Additional properties., name: properties } - java: { description: Additional properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.AnySchema - apiVersions: [] - language: - default: { description: Any object, name: AnyObject } - protocol: {} - type: ANY_OBJECT - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: The list of operations., - name: OperationEntityListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id137 - operationGroup: *id132 - operationId: Operations_List - parameters: - - *id006 - - *id009 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id009 - - *id138 - protocol: - http: - { - explode: false, - method: get, - path: /providers/Microsoft.BotService/operations, - uri: "{$host}", - } - signatureParameters: [] - responses: *id139 - signatureParameters: [] - - *id134 - protocol: {} - - &id140 - $key: BotConnection - codeModel: *id001 - language: - default: { description: "", name: BotConnection } - java: { description: "", name: BotConnection } - operations: - - &id141 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Auth Service Providers: - parameters: { api-version: 2021-05-01-preview, subscriptionId: subscription-id } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListServiceProviders.json - responses: - "200": - body: - value: - - properties: - devPortalUrl: sampleDevPortalUrl - displayName: sample service provider display name - iconUrl: sampleIconUrl - id: sampleServiceProviderId - parameters: - - { - name: sampleParameterName, - type: sampleParameterType, - description: sampleDescription, - default: sampleDefaultValue, - displayName: sampleDisplayName, - helpUrl: sampleHelpUrl, - } - serviceProviderName: sampleServiceProvider - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Lists the available Service Providers for creating Connection - Settings, name: ListServiceProviders } - java: { description: Lists the available Service Providers for creating Connection - Settings, name: listServiceProviders } - operationGroup: *id140 - operationId: BotConnection_ListServiceProviders - parameters: - - *id006 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id141 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders", - uri: "{$host}", - } - signatureParameters: [] - responses: - - language: - default: { description: "If resource is retrieved successfully, the service - should return 200 (OK).", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id272 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: The list of bot service providers response., - name: ServiceProviderResponseList, - namespace: "", - } - java: - { - description: The list of bot service providers response., - name: ServiceProviderResponseList, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The link used to get the next page of bot service - providers., name: nextLink } - java: { description: The link used to get the next page of bot service - providers., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id375 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The link used to get the next page of bot service - providers., name: ServiceProviderResponseListNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the list of bot service providers and their - properties., name: value } - java: - { - description: Gets the list of bot service providers and their properties., - name: value, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id212 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id273 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: Service Provider Definition, - name: ServiceProvider, - namespace: "", - } - java: { description: Service Provider Definition, name: ServiceProvider } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The Properties of a Service Provider Object, - name: properties, - } - java: - { - description: The Properties of a Service Provider Object, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id274 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The Object used to describe a Service Provider - supported by Bot Service, name: ServiceProviderProperties, namespace: "" } - java: { description: The Object used to describe a Service Provider - supported by Bot Service, name: ServiceProviderProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Id for Service Provider, name: Id } - java: { description: Id for Service Provider, name: id } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id376 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Id for Service Provider, - name: ServiceProviderPropertiesId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display Name of the Service Provider, - name: displayName, - } - java: - { - description: Display Name of the Service Provider, - name: displayName, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id377 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Display Name of the Service Provider, - name: ServiceProviderPropertiesDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display Name of the Service Provider, - name: serviceProviderName, - } - java: - { - description: Display Name of the Service Provider, - name: serviceProviderName, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id378 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Display Name of the Service Provider, - name: ServiceProviderPropertiesServiceProviderName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: serviceProviderName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display Name of the Service Provider, - name: devPortalUrl, - } - java: - { - description: Display Name of the Service Provider, - name: devPortalUrl, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id379 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Display Name of the Service Provider, - name: ServiceProviderPropertiesDevPortalUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: devPortalUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display Name of the Service Provider, - name: iconUrl, - } - java: - { - description: Display Name of the Service Provider, - name: iconUrl, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id380 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Display Name of the Service Provider, - name: ServiceProviderPropertiesIconUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: iconUrl - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The list of parameters for the Service - Provider, name: parameters } - java: - { - description: The list of parameters for the Service Provider, - name: parameters, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id211 - apiVersions: - - { version: 2021-05-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id275 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: Extra Parameters specific to each - Service Provider, name: ServiceProviderParameter, namespace: "" } - java: { description: Extra Parameters specific to each Service - Provider, name: ServiceProviderParameter } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Name of the Service Provider, - name: name, - } - java: - { - description: Name of the Service Provider, - name: name, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id381 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Name of the Service Provider, - name: ServiceProviderParameterName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Type of the Service Provider, - name: type, - } - java: - { - description: Type of the Service Provider, - name: type, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id382 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Type of the Service Provider, - name: ServiceProviderParameterType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display Name of the Service Provider, - name: displayName, - } - java: - { - description: Display Name of the Service Provider, - name: displayName, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id383 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Display Name of the Service Provider, - name: ServiceProviderParameterDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Description of the Service Provider, - name: description, - } - java: - { - description: Description of the Service Provider, - name: description, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id384 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Description of the Service Provider, - name: ServiceProviderParameterDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Help Url for the Service Provider, - name: helpUrl, - } - java: - { - description: Help Url for the Service Provider, - name: helpUrl, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id385 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Help Url for the Service Provider, - name: ServiceProviderParameterHelpUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: helpUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Default Name for the Service Provider, - name: default, - } - java: - { - description: Default Name for the Service Provider, - name: defaultProperty, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id386 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: Default Name for the Service - Provider, name: ServiceProviderParameterDefault } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: default - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Meta data for the Service Provider, - name: metadata, - } - java: - { - description: Meta data for the Service Provider, - name: metadata, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id276 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: - { - description: Meta data for the Service Provider, - name: ServiceProviderParameterMetadata, - namespace: "", - } - java: - { - description: Meta data for the Service Provider, - name: ServiceProviderParameterMetadata, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: the constraints of the bot - meta data., name: constraints } - java: { description: the constraints of the bot meta - data., name: constraints } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id277 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: the constraints of the bot - meta data., name: ServiceProviderParameterMetadataConstraints, namespace: "" } - java: - { description: the constraints of the bot meta - data., name: ServiceProviderParameterMetadataConstraints } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Whether required the constraints - of the bot meta data., - name: required, - } - java: - { - description: - Whether required the constraints - of the bot meta data., - name: required, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id233 - apiVersions: [] - language: - default: { description: Whether required the - constraints of the bot meta data., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: required - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: constraints - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: metadata - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: The list of parameters for the Service - Provider, name: ServiceProviderPropertiesParameters } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: parameters - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: Gets the list of bot service providers and their - properties., name: ServiceProviderResponseListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - - &id142 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: "Error response describing why the operation failed. - If the resource group *or* resource does not exist, 404 (NotFound) should - be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Update Connection Setting: - parameters: - { - api-version: 2021-05-01-preview, - connectionName: sampleConnection, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetConnection.json - responses: - "200": - body: - name: sampleConnection - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname/connections/sampleConnection - location: global - properties: - clientId: sampleclientid - clientSecret: null - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderDisplayName: serviceProviderDisplayName - serviceProviderId: serviceproviderid - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { - description: Get a Connection Setting registration for a Bot Service, - name: ListWithSecrets, - } - java: - { - description: Get a Connection Setting registration for a Bot Service, - name: listWithSecrets, - } - operationGroup: *id140 - operationId: BotConnection_ListWithSecrets - parameters: - - *id006 - - &id143 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id142 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id144 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id142 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id145 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - java: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - nullable: false - operation: *id142 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id147 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: "", name: String } - maxLength: 64.0 - minLength: 2.0 - pattern: ^[a-zA-Z0-9][\sa-zA-Z0-9_.-]*$ - protocol: {} - type: STRING - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id143 - - *id144 - - *id145 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id142 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}/listWithSecrets", - uri: "{$host}", - } - signatureParameters: - - *id143 - - *id144 - - *id145 - responses: - - language: - default: { description: "The resource provider should return 200 (OK) to indicate - that the operation completed successfully. ", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id048 - signatureParameters: - - *id143 - - *id144 - - *id145 - - &id146 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create Connection Setting: - parameters: - api-version: 2021-05-01-preview - connectionName: sampleConnection - parameters: - etag: etag1 - location: West US - properties: - clientId: sampleclientid - clientSecret: samplesecret - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderId: serviceproviderid - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/PutConnection.json - responses: - "200": - body: - name: sampleConnection - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname/connections/sampleConnection - location: global - properties: - clientId: sampleclientid - clientSecret: null - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderDisplayName: serviceProviderDisplayName - serviceProviderId: serviceproviderid - "201": - body: - name: sampleConnection - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname/connections/sampleConnection - location: global - properties: - clientId: sampleclientid - clientSecret: null - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderDisplayName: serviceProviderDisplayName - serviceProviderId: serviceproviderid - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Register a new Auth Connection for a Bot Service, name: Create } - java: { description: Register a new Auth Connection for a Bot Service, name: create } - operationGroup: *id140 - operationId: BotConnection_Create - parameters: - - *id006 - - &id148 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id146 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id149 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id146 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id150 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - java: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - nullable: false - operation: *id146 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id147 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id148 - - *id149 - - *id150 - - *id009 - - *id005 - - &id151 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The parameters to provide for creating the Connection - Setting., name: parameters } - java: { description: The parameters to provide for creating the Connection - Setting., name: parameters } - nullable: false - operation: *id146 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id048 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id146 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName} - uri: "{$host}" - signatureParameters: - - *id148 - - *id149 - - *id150 - - *id151 - responses: - - language: - default: { description: "If resource is created successfully or already existed, - the service should return 200 (OK).", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id048 - - language: - default: { description: "If resource is created successfully, the service should - return 201 (Created). Execution to continue asynchronously.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id048 - signatureParameters: - - *id148 - - *id149 - - *id150 - - &id152 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Update Connection Setting: - parameters: - api-version: 2021-05-01-preview - connectionName: sampleConnection - parameters: - etag: etag1 - location: global - properties: - clientId: sampleclientid - clientSecret: samplesecret - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderDisplayName: serviceProviderDisplayName - serviceProviderId: serviceproviderid - resourceGroupName: OneResourceGroupName - resourceName: samplebotname - subscriptionId: subscription-id - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/UpdateConnection.json - responses: - "200": - body: - name: sampleConnection - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname/connections/sampleConnection - location: global - properties: - clientId: sampleclientid - clientSecret: null - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderDisplayName: serviceProviderDisplayName - serviceProviderId: serviceproviderid - "201": - body: - name: sampleConnection - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname/connections/sampleConnection - location: global - properties: - clientId: sampleclientid - clientSecret: null - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderDisplayName: serviceProviderDisplayName - serviceProviderId: serviceproviderid - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { - description: Updates a Connection Setting registration for a Bot Service, - name: Update, - } - java: - { - description: Updates a Connection Setting registration for a Bot Service, - name: update, - } - operationGroup: *id140 - operationId: BotConnection_Update - parameters: - - *id006 - - &id153 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id152 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id154 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id152 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id155 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - java: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - nullable: false - operation: *id152 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id147 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id153 - - *id154 - - *id155 - - *id009 - - *id005 - - &id156 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The parameters to provide for updating the Connection - Setting., name: parameters } - java: { description: The parameters to provide for updating the Connection - Setting., name: parameters } - nullable: false - operation: *id152 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id048 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id152 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: patch - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName} - uri: "{$host}" - signatureParameters: - - *id153 - - *id154 - - *id155 - - *id156 - responses: - - language: - default: { description: "If resource is created successfully or already existed, - the service should return 200 (OK).", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id048 - - language: - default: { description: "If resource is created successfully, the service should - return 201 (Created). Execution to continue asynchronously.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id048 - signatureParameters: - - *id153 - - *id154 - - *id155 - - &id157 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: "Error response describing why the operation failed. - If the resource group *or* resource does not exist, 404 (NotFound) should - be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Update Connection Setting: - parameters: - { - api-version: 2021-05-01-preview, - connectionName: sampleConnection, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetConnection.json - responses: - "200": - body: - name: sampleConnection - etag: etag1 - id: /subscriptions/subscription-id/resourceGroups/OneResourceGroupName/providers/Microsoft.BotService/botServices/samplebotname/connections/sampleConnection - location: global - properties: - clientId: sampleclientid - clientSecret: null - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderDisplayName: serviceProviderDisplayName - serviceProviderId: serviceproviderid - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { description: Get a Connection Setting registration for a Bot Service, name: Get } - java: { description: Get a Connection Setting registration for a Bot Service, name: get } - operationGroup: *id140 - operationId: BotConnection_Get - parameters: - - *id006 - - &id158 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id157 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id159 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id157 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id160 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - java: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - nullable: false - operation: *id157 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id147 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id158 - - *id159 - - *id160 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id157 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", - uri: "{$host}", - } - signatureParameters: - - *id158 - - *id159 - - *id160 - responses: - - language: - default: { description: "The resource provider should return 200 (OK) to indicate - that the operation completed successfully. ", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id048 - signatureParameters: - - *id158 - - *id159 - - *id160 - - &id161 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Update Connection Setting: - parameters: - { - api-version: 2021-05-01-preview, - connectionName: sampleConnection, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/DeleteConnection.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { - description: Deletes a Connection Setting registration for a Bot Service, - name: Delete, - } - java: - { - description: Deletes a Connection Setting registration for a Bot Service, - name: delete, - } - operationGroup: *id140 - operationId: BotConnection_Delete - parameters: - - *id006 - - &id162 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id161 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id163 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id161 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id164 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - java: - { - description: The name of the Bot Service Connection Setting resource., - name: connectionName, - serializedName: connectionName, - } - nullable: false - operation: *id161 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id147 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id162 - - *id163 - - *id164 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id161 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections/{connectionName}", - uri: "{$host}", - } - signatureParameters: - - *id162 - - *id163 - - *id164 - responses: - - language: - default: { description: A 200 (OK) should be returned if the object exists - and was deleted successfully;, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: a 204 (NoContent) should be used if the resource does - not exist and the request is well formed., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id162 - - *id163 - - *id164 - - &id170 - apiVersions: &id165 - - { version: 2021-05-01-preview } - exceptions: &id166 - - language: - default: { description: "Error response describing why the operation failed. - If the resource group does not exist, 404 (NotFound) will be returned.", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: &id167 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Connection Settings: - parameters: - { - api-version: 2021-05-01-preview, - resourceGroupName: OneResourceGroupName, - resourceName: samplebotname, - subscriptionId: subscription-id, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListConnectionsByBotService.json - responses: - "200": - body: - value: - - name: sampleConnection - properties: - clientId: sampleclientid - clientSecret: null - parameters: - - { key: key1, value: value1 } - - { key: key2, value: value2 } - scopes: samplescope - serviceProviderId: serviceproviderid - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id169 - $key: listByBotServiceNext - apiVersions: *id165 - exceptions: *id166 - extensions: *id167 - language: - java: { description: Get the next page of items, name: listByBotServiceNext } - operationGroup: *id140 - parameters: [] - requests: - - language: &id172 - default: { description: Returns all the Connection Settings registered - to a particular BotService resource, name: ListByBotService } - java: { description: Returns all the Connection Settings registered to - a particular BotService resource, name: listByBotService } - parameters: - - &id171 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id168 { name: nextLink, serializedName: nextLink } - java: *id168 - nullable: false - operation: *id169 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id006 - - &id175 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id170 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id171 - responses: &id176 - - language: - default: - description: "The resource provider should return 200 (OK) to indicate\ - \ that the operation completed successfully. For other errors (e.g.\ - \ internal errors) use the appropriate HTTP error code.\nThe nextLink\ - \ field is expected to point to the URL the client should use to\ - \ fetch the next page (per server side paging). This matches the\ - \ OData guidelines for paged responses here. If a resource provider\ - \ does not support paging, it should return the same body (JSON\ - \ object with “value” property) but omit nextLink entirely (or set\ - \ to null, *not* empty string) for future compatibility.\nThe nextLink\ - \ should be implemented using following query parameters:\n· skipToken:\ - \ opaque token that allows the resource provider to skip resources\ - \ already enumerated. This value is defined and returned by the\ - \ RP after first request via nextLink.\n· top: the optional client\ - \ query parameter which defines the maximum number of records to\ - \ be returned by the server.\nImplementation details:\n· NextLink\ - \ may include all the query parameters (specifically OData $filter)\ - \ used by the client in the first query. \n· Server may return less\ - \ records than requested with nextLink. Returning zero records with\ - \ NextLink is an acceptable response. \nClients must fetch records\ - \ until the nextLink is not returned back / null. Clients should\ - \ never rely on number of returned records to determinate if pagination\ - \ is completed." - name: "" - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id280 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The list of bot service connection settings - response., name: ConnectionSettingResponseList, namespace: "" } - java: - { - description: The list of bot service connection settings response., - name: ConnectionSettingResponseList, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The link used to get the next page of bot - service connection setting resources., name: nextLink } - java: { description: The link used to get the next page of bot service - connection setting resources., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id398 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The link used to get the next page of bot - service connection setting resources., name: ConnectionSettingResponseListNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the list of bot service connection settings - and their properties., name: value } - java: { description: Gets the list of bot service connection settings - and their properties., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id214 - apiVersions: - - { version: 2021-05-01-preview } - elementType: *id048 - language: - default: { description: Gets the list of bot service connection - settings and their properties., name: ConnectionSettingResponseListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id172 - operationGroup: *id140 - operationId: BotConnection_ListByBotService - parameters: - - *id006 - - &id173 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id170 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id174 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id170 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id005 - - *id009 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id173 - - *id174 - - *id005 - - *id009 - - *id175 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections", - uri: "{$host}", - } - signatureParameters: - - *id173 - - *id174 - responses: *id176 - signatureParameters: - - *id173 - - *id174 - - *id169 - protocol: {} - - &id177 - $key: HostSettings - codeModel: *id001 - language: - default: { description: "", name: HostSettings } - java: { description: "", name: HostSettings } - operations: - - &id178 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation failed, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get Bot Host Settings: - parameters: { api-version: 2021-05-01-preview, subscriptionId: subscription-id } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetHostSettings.json - responses: - "200": - body: - { - BotOpenIdMetadata: "https://login.botframework.com/v1/.well-known/openidconfiguration", - OAuthUrl: "https://token.botframework.com/", - ToBotFromChannelOpenIdMetadataUrl: "https://login.botframework.com/v1/.well-known/openidconfiguration", - ToBotFromChannelTokenIssuer: "https://api.botframework.com", - ToBotFromEmulatorOpenIdMetadataUrl: "https://login.microsoftonline.com/botframework.com/v2.0/.well-known/openid-configuration", - ToChannelFromBotLoginUrl: "https://login.microsoftonline.com/botframework.com", - ToChannelFromBotOAuthScope: "https://api.botframework.com", - ValidateAuthority: true, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get per subscription settings needed to host bot in compute - resource such as Azure App Service, name: Get } - java: { description: Get per subscription settings needed to host bot in compute - resource such as Azure App Service, name: get } - operationGroup: *id177 - operationId: HostSettings_Get - parameters: - - *id006 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id178 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/hostSettings", - uri: "{$host}", - } - signatureParameters: [] - responses: - - language: - default: { description: "If resource is retrieved successfully, the service - should return 200 (OK).", name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id281 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The response body returned for a request to Bot Service - Management to check per subscription hostSettings, name: HostSettingsResponse, namespace: "" } - java: { description: The response body returned for a request to Bot Service - Management to check per subscription hostSettings, name: HostSettingsResponse } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: For in-conversation bot user authentication, name: oAuthUrl } - java: - { description: For in-conversation bot user authentication, name: oAuthUrl } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id399 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: For in-conversation bot user authentication, - name: HostSettingsResponseOAuthUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: OAuthUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: For verifying incoming tokens from the channels, - name: toBotFromChannelOpenIdMetadataUrl, - } - java: - { - description: For verifying incoming tokens from the channels, - name: toBotFromChannelOpenIdMetadataUrl, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id400 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: For verifying incoming tokens from the channels, - name: HostSettingsResponseToBotFromChannelOpenIdMetadataUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: ToBotFromChannelOpenIdMetadataUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: For verifying incoming tokens from the channels, - name: toBotFromChannelTokenIssuer, - } - java: - { - description: For verifying incoming tokens from the channels, - name: toBotFromChannelTokenIssuer, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id401 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: For verifying incoming tokens from the channels, - name: HostSettingsResponseToBotFromChannelTokenIssuer, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: ToBotFromChannelTokenIssuer - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: For verifying incoming tokens from bot emulator, - name: toBotFromEmulatorOpenIdMetadataUrl, - } - java: - { - description: For verifying incoming tokens from bot emulator, - name: toBotFromEmulatorOpenIdMetadataUrl, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id402 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: For verifying incoming tokens from bot emulator, - name: HostSettingsResponseToBotFromEmulatorOpenIdMetadataUrl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: ToBotFromEmulatorOpenIdMetadataUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: For getting access token to channels from bot host, - name: toChannelFromBotLoginUrl, - } - java: - { - description: For getting access token to channels from bot host, - name: toChannelFromBotLoginUrl, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id403 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: For getting access token to channels from bot - host, name: HostSettingsResponseToChannelFromBotLoginUrl } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: ToChannelFromBotLoginUrl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: For getting access token to channels from bot host, - name: toChannelFromBotOAuthScope, - } - java: - { - description: For getting access token to channels from bot host, - name: toChannelFromBotOAuthScope, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id404 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: For getting access token to channels from bot - host, name: HostSettingsResponseToChannelFromBotOAuthScope } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: ToChannelFromBotOAuthScope - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Per cloud OAuth setting on whether authority is - validated, name: validateAuthority } - java: - { - description: Per cloud OAuth setting on whether authority is validated, - name: validateAuthority, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id234 - apiVersions: [] - language: - default: { description: Per cloud OAuth setting on whether authority - is validated, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: ValidateAuthority - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Same as toBotFromChannelOpenIdMetadataUrl, used - by SDK < v4.12", name: botOpenIdMetadata } - java: { description: "Same as toBotFromChannelOpenIdMetadataUrl, used by - SDK < v4.12", name: botOpenIdMetadata } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id405 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: "Same as toBotFromChannelOpenIdMetadataUrl, used - by SDK < v4.12", name: HostSettingsResponseBotOpenIdMetadata } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: BotOpenIdMetadata - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - protocol: {} - - &id179 - $key: OperationResults - codeModel: *id001 - language: - default: { description: "", name: OperationResults } - java: { description: "", name: OperationResults } - operations: - - &id180 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: Default error response, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get operation result: - parameters: - { - api-version: 2021-05-01-preview, - operationResultId: exampleid, - subscriptionId: subid, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/OperationResultsGet.json - responses: - "200": - body: - { - name: servicename, - id: /subscriptions/subid/providers/Microsoft.BotService/locations/westus/operationresults/exampleid, - startTime: "2019-01-21T06:03:30.2716301Z", - status: Requested, - } - "202": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsSkipUrlEncoding: false - language: - default: - { description: Get the operation result for a long running operation., name: Get } - java: { description: Get the operation result for a long running operation., name: get } - operationGroup: *id179 - operationId: OperationResults_Get - parameters: - - *id006 - - *id009 - - *id005 - - &id181 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the operation result to get., - name: operationResultId, - serializedName: operationResultId, - } - java: - { - description: The ID of the operation result to get., - name: operationResultId, - serializedName: operationResultId, - } - nullable: false - operation: *id180 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id049 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id009 - - *id005 - - *id181 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id180 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.BotService/operationresults/{operationResultId}", - uri: "{$host}", - } - signatureParameters: - - *id181 - responses: - - language: - default: { description: The body contains all of the properties of the operation - result., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id282 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: The properties indicating the operation result of - an operation on a service., name: OperationResultsDescription, namespace: "" } - java: { description: The properties indicating the operation result of an - operation on a service., name: OperationResultsDescription } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The ID of the operation returned., name: Id } - java: { description: The ID of the operation returned., name: id } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id406 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The ID of the operation returned., - name: OperationResultsDescriptionId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The name of the operation result., name: name } - java: { description: The name of the operation result., name: name } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id407 - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: The name of the operation result., - name: OperationResultsDescriptionName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The status of the operation being performed., name: status } - java: - { description: The status of the operation being performed., name: status } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id253 - apiVersions: - - { version: 2021-05-01-preview } - choiceType: *id004 - choices: - - language: - default: { description: "", name: CANCELED } - value: Canceled - - language: - default: { description: "", name: SUCCEEDED } - value: Succeeded - - language: - default: { description: "", name: FAILED } - value: Failed - - language: - default: { description: "", name: REQUESTED } - value: Requested - - language: - default: { description: "", name: RUNNING } - value: Running - language: - default: - { - description: The status of the operation being performed., - name: OperationResultStatus, - } - java: - { - description: The status of the operation being performed., - name: OperationResultStatus, - } - protocol: {} - type: CHOICE - serializedName: status - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The time that the operation was started., name: startTime } - java: { description: The time that the operation was started., name: startTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id255 - apiVersions: - - { version: 2021-05-01-preview } - format: DATE_TIME - language: - default: - { - description: The time that the operation was started., - name: OperationResultsDescriptionStartTime, - } - protocol: {} - type: DATE_TIME - serializedName: startTime - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - language: - default: { description: Accepted - Get request accepted; the operation will - complete asynchronously., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - signatureParameters: - - *id181 - protocol: {} - - &id182 - $key: PrivateEndpointConnections - codeModel: *id001 - language: - default: { description: "", name: PrivateEndpointConnections } - java: { description: "", name: PrivateEndpointConnections } - operations: - - &id183 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: Default error response, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List Private Endpoint Connections: - parameters: - { - api-version: 2021-05-01-preview, - resourceGroupName: res6977, - resourceName: sto2527, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/ListPrivateEndpointConnections.json - responses: - "200": - body: - value: - - name: "{privateEndpointConnectionName}" - type: Microsoft.BotService/botServices/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.BotService/botServices/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01", - } - privateLinkServiceConnectionState: - { - description: Auto-Approved, - actionsRequired: None, - status: Approved, - } - provisioningState: Succeeded - - name: "{privateEndpointConnectionName}" - type: Microsoft.BotService/botServices/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.BotService/botServices/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest02", - } - privateLinkServiceConnectionState: - { - description: Auto-Approved, - actionsRequired: None, - status: Approved, - } - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: { description: List all the private endpoint connections associated - with the Bot., name: List } - java: { description: List all the private endpoint connections associated with - the Bot., name: list } - operationGroup: *id182 - operationId: PrivateEndpointConnections_List - parameters: - - *id006 - - &id184 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id183 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id185 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id183 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id184 - - *id185 - - *id009 - - *id005 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id183 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections", - uri: "{$host}", - } - signatureParameters: - - *id184 - - *id185 - responses: - - language: - default: - { - description: OK -- Successfully retrieved private endpoint connections., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id283 - apiVersions: - - { version: 2021-05-01-preview } - flattenedSchema: false - language: - default: { description: List of private endpoint connection associated with - the specified storage account, name: PrivateEndpointConnectionListResult, namespace: "" } - java: { description: List of private endpoint connection associated with - the specified storage account, name: PrivateEndpointConnectionListResult } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Array of private endpoint connections, name: value } - java: { description: Array of private endpoint connections, name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id215 - apiVersions: - - { version: 2021-05-01-preview } - elementType: *id012 - language: - default: - { - description: Array of private endpoint connections, - name: PrivateEndpointConnectionListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id184 - - *id185 - - &id186 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get Private Endpoint Connection: - parameters: - { - api-version: 2021-05-01-preview, - privateEndpointConnectionName: "{privateEndpointConnectionName}", - resourceGroupName: res6977, - resourceName: sto2527, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/GetPrivateEndpointConnection.json - responses: - "200": - body: - name: "{privateEndpointConnectionName}" - type: Microsoft.BotService/botServices/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.BotService/botServices/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01", - } - privateLinkServiceConnectionState: - { description: Auto-Approved, actionsRequired: None, status: Approved } - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets the specified private endpoint connection associated - with the Bot., name: Get } - java: { description: Gets the specified private endpoint connection associated - with the Bot., name: get } - operationGroup: *id182 - operationId: PrivateEndpointConnections_Get - parameters: - - *id006 - - &id187 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id186 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id188 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id186 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - - &id189 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - java: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - nullable: false - operation: *id186 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id191 - apiVersions: - - { version: "1.0" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id187 - - *id188 - - *id009 - - *id005 - - *id189 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id186 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - uri: "{$host}", - } - signatureParameters: - - *id187 - - *id188 - - *id189 - responses: - - language: - default: { description: OK -- Get the private endpoint connection properties - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id012 - signatureParameters: - - *id187 - - *id188 - - *id189 - - &id190 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Put Private Endpoint Connection: - parameters: - api-version: 2021-05-01-preview - privateEndpointConnectionName: "{privateEndpointConnectionName}" - properties: - properties: - privateLinkServiceConnectionState: - { description: Auto-Approved, status: Approved } - resourceGroupName: res7687 - resourceName: sto9699 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/PutPrivateEndpointConnection.json - responses: - "200": - body: - name: "{privateEndpointConnectionName}" - type: Microsoft.BotService/botServices/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.BotService/botServices/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01", - } - privateLinkServiceConnectionState: - { description: Auto-Approved, actionsRequired: None, status: Approved } - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Update the state of specified private endpoint connection - associated with the Bot., name: Create } - java: { description: Update the state of specified private endpoint connection - associated with the Bot., name: create } - operationGroup: *id182 - operationId: PrivateEndpointConnections_Create - parameters: - - *id006 - - &id192 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id190 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id193 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id190 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - - &id194 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - java: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - nullable: false - operation: *id190 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id191 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id192 - - *id193 - - *id009 - - *id005 - - *id194 - - &id195 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: The private endpoint connection properties., name: properties } - java: - { description: The private endpoint connection properties., name: properties } - nullable: false - operation: *id190 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id012 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id190 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - uri: "{$host}" - signatureParameters: - - *id192 - - *id193 - - *id194 - - *id195 - responses: - - language: - default: { description: OK -- Update the private endpoint connection properties - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id012 - signatureParameters: - - *id192 - - *id193 - - *id194 - - &id196 - apiVersions: - - { version: 2021-05-01-preview } - exceptions: - - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id014 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete Private Endpoint Connection: - parameters: - { - api-version: 2021-05-01-preview, - privateEndpointConnectionName: "{privateEndpointConnectionName}", - resourceGroupName: res6977, - resourceName: sto2527, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/eecf176ecfdcf43bfc98219740a89103c9644599/specification/botservice/resource-manager/Microsoft.BotService/preview/2021-05-01-preview/examples/DeletePrivateEndpointConnection.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes the specified private endpoint connection associated - with the Bot., name: Delete } - java: { description: Deletes the specified private endpoint connection associated - with the Bot., name: delete } - operationGroup: *id182 - operationId: PrivateEndpointConnections_Delete - parameters: - - *id006 - - &id197 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the Bot resource group in the user subscription., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - &id198 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the Bot resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id003 - - *id009 - - *id005 - - &id199 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - java: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id191 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id006 - - *id197 - - *id198 - - *id009 - - *id005 - - *id199 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id196 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id051 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - uri: "{$host}", - } - signatureParameters: - - *id197 - - *id198 - - *id199 - responses: - - language: - default: - { - description: OK -- Delete the private endpoint connection successfully., - name: "", - } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content -- The private endpoint connection does - not exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id197 - - *id198 - - *id199 - protocol: {} - - *id200 -protocol: - http: { explode: false } -schemas: - ands: [] - arrays: - - *id201 - - *id202 - - *id203 - - *id204 - - *id205 - - *id206 - - *id207 - - *id208 - - *id209 - - *id210 - - *id211 - - *id212 - - *id213 - - *id214 - - *id215 - - *id216 - - *id217 - - *id218 - - *id219 - - *id220 - - *id221 - - *id222 - binaries: [] - booleans: - - *id223 - - *id224 - - *id225 - - *id050 - - *id226 - - *id227 - - *id228 - - *id229 - - *id026 - - *id230 - - *id231 - - *id023 - - *id232 - - *id233 - - *id234 - - *id235 - - *id236 - - *id237 - - *id238 - - *id239 - - *id240 - - *id241 - - *id242 - - *id028 - - *id243 - - *id244 - - *id245 - byteArrays: [] - chars: [] - choices: - - *id246 - - *id247 - - *id248 - - *id249 - - *id250 - - *id251 - - *id252 - - *id253 - constants: - - *id254 - - *id051 - credentials: [] - dateTimes: - - *id255 - dates: [] - dictionaries: - - *id256 - - *id257 - - *id258 - durations: [] - flags: [] - groups: [] - numbers: [] - objects: - - *id019 - - *id259 - - *id012 - - *id260 - - *id261 - - *id262 - - *id010 - - *id021 - - *id263 - - *id014 - - *id081 - - *id020 - - *id022 - - *id043 - - *id264 - - *id025 - - *id024 - - *id027 - - *id265 - - *id266 - - *id267 - - *id268 - - *id269 - - *id270 - - *id271 - - *id272 - - *id273 - - *id274 - - *id275 - - *id276 - - *id277 - - *id048 - - *id278 - - *id279 - - *id280 - - *id281 - - *id282 - - *id283 - - *id284 - - *id011 - - *id285 - - *id029 - - *id286 - - *id030 - - *id287 - - *id288 - - *id031 - - *id289 - - *id032 - - *id290 - - *id033 - - *id291 - - *id034 - - *id292 - - *id035 - - *id293 - - *id036 - - *id294 - - *id037 - - *id295 - - *id038 - - *id296 - - *id039 - - *id297 - - *id040 - - *id298 - - *id299 - - *id041 - - *id300 - odataQueries: [] - ors: [] - parameterGroups: [] - sealedChoices: - - *id094 - - *id301 - - *id302 - streams: [] - strings: - - *id004 - - *id003 - - *id049 - - *id303 - - *id304 - - *id305 - - *id306 - - *id307 - - *id308 - - *id309 - - *id310 - - *id311 - - *id312 - - *id313 - - *id314 - - *id315 - - *id316 - - *id317 - - *id318 - - *id319 - - *id320 - - *id321 - - *id322 - - *id323 - - *id324 - - *id325 - - *id326 - - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: "Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", - name: PrivateLinkResourceBaseId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The name of the resource, name: PrivateLinkResourceBaseName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: 2021-05-01-preview } - language: - default: { description: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" - or "Microsoft.Storage/storageAccounts", name: PrivateLinkResourceBaseType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id327 - - *id328 - - *id329 - - *id330 - - *id331 - - *id332 - - *id333 - - *id334 - - *id335 - - *id336 - - *id337 - - *id338 - - *id339 - - *id340 - - *id341 - - *id342 - - *id343 - - *id344 - - *id345 - - *id346 - - *id347 - - *id348 - - *id349 - - *id350 - - *id351 - - *id352 - - *id353 - - *id354 - - *id355 - - *id356 - - *id357 - - *id358 - - *id359 - - *id360 - - *id361 - - *id362 - - *id363 - - *id364 - - *id365 - - *id366 - - *id367 - - *id368 - - *id369 - - *id370 - - *id371 - - *id372 - - *id373 - - *id374 - - *id375 - - *id376 - - *id377 - - *id378 - - *id379 - - *id380 - - *id381 - - *id382 - - *id383 - - *id384 - - *id385 - - *id386 - - *id147 - - *id387 - - *id388 - - *id389 - - *id390 - - *id391 - - *id392 - - *id393 - - *id394 - - *id395 - - *id396 - - *id397 - - *id398 - - *id399 - - *id400 - - *id401 - - *id402 - - *id403 - - *id404 - - *id405 - - *id406 - - *id407 - - *id191 - - *id408 - - *id409 - - *id410 - - *id411 - - *id412 - - *id413 - - *id414 - - *id415 - - *id416 - - *id417 - - *id418 - - *id419 - - *id420 - - *id421 - - *id422 - - *id423 - - *id424 - - *id425 - - *id426 - - *id427 - - *id428 - - *id429 - - *id430 - - *id431 - - *id432 - - *id433 - - *id434 - - *id435 - - *id436 - - *id437 - - *id438 - - *id439 - - *id440 - - *id441 - - *id442 - - *id443 - - *id444 - - *id445 - - *id446 - - *id447 - - *id448 - - *id449 - - *id450 - - *id451 - - apiVersions: - - { version: 2021-05-01-preview } - language: - default: - { - description: Connection Item name that has been added in the API, - name: ConnectionItemName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - unixtimes: [] - unknowns: [] - uris: [] - uuids: [] - xors: [] -security: - authenticationRequired: false - schemes: [] diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-locks.yaml b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-locks.yaml deleted file mode 100644 index 6275150c0c..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-locks.yaml +++ /dev/null @@ -1,3808 +0,0 @@ -!!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel &id004 -apiVersions: [] -clients: [] -globalParameters: - - &id024 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattened: false - implementation: CLIENT - language: - default: - { - description: The ID of the target subscription., - name: SubscriptionId, - serializedName: subscriptionId, - } - java: - { - description: The ID of the target subscription., - name: subscriptionId, - serializedName: subscriptionId, - } - nullable: false - operation: &id105 - apiVersions: &id001 - - { version: "2016-09-01" } - exceptions: &id002 [] - extensions: &id003 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List management locks at subscription level: - parameters: { api-version: "2016-09-01", subscriptionId: subscriptionId } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_ListAtSubscriptionLevel.json - responses: - "200": - body: - value: - - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id106 - $key: listAtSubscriptionLevelNext - apiVersions: *id001 - exceptions: *id002 - extensions: *id003 - language: - java: { description: Get the next page of items, name: listAtSubscriptionLevelNext } - operationGroup: &id005 - $key: ManagementLocks - codeModel: *id004 - language: - default: { description: "", name: ManagementLocks } - java: { description: "", name: ManagementLocks } - operations: - - &id023 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create management lock at resource group level: - parameters: - api-version: "2016-09-01" - lockName: testlock - parameters: - properties: { level: ReadOnly } - resourceGroupName: resourcegroupname - subscriptionId: subscriptionId - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_CreateOrUpdateAtResourceGroupLevel.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - "201": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "When you apply a lock at a parent scope, all - child resources inherit the same lock. To create management locks, - you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: CreateOrUpdateAtResourceGroupLevel, summary: Creates or updates a management lock at the resource group - level. } - java: { description: "When you apply a lock at a parent scope, all - child resources inherit the same lock. To create management locks, - you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: createOrUpdateAtResourceGroupLevel } - operationGroup: *id005 - operationId: ManagementLocks_CreateOrUpdateAtResourceGroupLevel - parameters: - - &id011 - apiVersions: [] - clientDefaultValue: https://management.azure.com - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: CLIENT - language: - default: - { description: server parameter, name: endpoint, serializedName: $host } - java: - { description: server parameter, name: endpoint, serializedName: $host } - nullable: false - operation: &id012 - apiVersions: &id006 - - { version: "2016-09-01" } - exceptions: &id007 [] - extensions: &id008 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List management locks at scope: - parameters: - { api-version: "2016-09-01", scope: subscriptions/subscriptionId } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_ListAtScope.json - responses: - "200": - body: - value: - - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id010 - $key: listByScopeNext - apiVersions: *id006 - exceptions: *id007 - extensions: *id008 - language: - java: - { description: Get the next page of items, name: listByScopeNext } - operationGroup: *id005 - parameters: [] - requests: - - language: &id016 - default: { description: Gets all the management locks for - a scope., name: ListByScope } - java: { description: Gets all the management locks for - a scope., name: listByScope } - parameters: - - &id013 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id009 { name: nextLink, serializedName: nextLink } - java: *id009 - nullable: false - operation: *id010 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id011 - - &id021 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - java: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - nullable: false - operation: *id012 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id028 - apiVersions: [] - language: - default: - { - description: "Accept: application/json", - name: Accept, - } - protocol: {} - type: CONSTANT - value: { value: application/json } - valueType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id015 - apiVersions: [] - language: - default: { description: simple string, name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: - http: - { - explode: false, - method: get, - path: "{nextLink}", - uri: "{$host}", - } - signatureParameters: - - *id013 - responses: &id022 - - language: - default: { description: OK - Returns an array of resource - locks., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id083 - apiVersions: - - { version: "2016-09-01" } - flattenedSchema: false - language: - default: - { - description: The list of locks., - name: ManagementLockListResult, - namespace: "", - } - java: - { - description: The list of locks., - name: ManagementLockListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The list of locks., name: value } - java: { description: The list of locks., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id126 - apiVersions: - - { version: "2016-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id027 - apiVersions: - - { version: "2016-09-01" } - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: The lock information., - name: ManagementLockObject, - namespace: "", - } - java: - { - description: The lock information., - name: ManagementLockObject, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id014 - apiVersions: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - java: { name: ProxyResource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - java: { description: the fully qualified - resource ID for the resource, name: id } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: the name of the resource, - name: name, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: the type of the resource, - name: type, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: type - stronglyTypedHeader: false - immediate: - - *id014 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The properties of the - lock., name: properties } - java: - { - description: The properties of the lock., - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id132 - apiVersions: - - { version: "2016-09-01" } - flattenedSchema: true - language: - default: - { - description: The lock properties., - name: ManagementLockProperties, - namespace: "", - } - java: - { - description: The lock properties., - name: ManagementLockProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The level of the - lock. Possible values are: NotSpecified, - CanNotDelete, ReadOnly. CanNotDelete - means authorized users are able to read - and modify the resources, but not delete. - ReadOnly means authorized users can - only read from a resource, but they - can't modify or delete it.", name: level } - java: { description: "The level of the lock. - Possible values are: NotSpecified, CanNotDelete, - ReadOnly. CanNotDelete means authorized - users are able to read and modify the - resources, but not delete. ReadOnly - means authorized users can only read - from a resource, but they can't modify - or delete it.", name: level } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id127 - apiVersions: - - { version: "2016-09-01" } - choiceType: *id015 - choices: - - language: - default: - { - description: "", - name: NOT_SPECIFIED, - } - value: NotSpecified - - language: - default: - { - description: "", - name: CAN_NOT_DELETE, - } - value: CanNotDelete - - language: - default: - { description: "", name: READ_ONLY } - value: ReadOnly - language: - default: { description: "The level of the - lock. Possible values are: NotSpecified, - CanNotDelete, ReadOnly. CanNotDelete - means authorized users are able to - read and modify the resources, but - not delete. ReadOnly means authorized - users can only read from a resource, - but they can't modify or delete it.", name: LockLevel } - java: { description: "The level of the - lock. Possible values are: NotSpecified, - CanNotDelete, ReadOnly. CanNotDelete - means authorized users are able to - read and modify the resources, but - not delete. ReadOnly means authorized - users can only read from a resource, - but they can't modify or delete it.", name: LockLevel } - protocol: {} - type: CHOICE - serializedName: level - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Notes about the lock. - Maximum of 512 characters., name: notes } - java: { description: Notes about the lock. - Maximum of 512 characters., name: notes } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id139 - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: Notes about the - lock. Maximum of 512 characters., name: ManagementLockPropertiesNotes } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: notes - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The owners of the - lock., name: owners } - java: - { - description: The owners of the lock., - name: owners, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id125 - apiVersions: - - { version: "2016-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id133 - apiVersions: - - { version: "2016-09-01" } - flattenedSchema: false - language: - default: - { - description: Lock owner properties., - name: ManagementLockOwner, - namespace: "", - } - java: - { - description: Lock owner properties., - name: ManagementLockOwner, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The application - ID of the lock owner., name: applicationId } - java: { description: The application - ID of the lock owner., name: applicationId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id140 - apiVersions: - - { version: "2016-09-01" } - language: - default: - { description: The application - ID of the lock owner., name: ManagementLockOwnerApplicationId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: applicationId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: The owners of the - lock., name: ManagementLockPropertiesOwners } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: owners - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: The list of locks., - name: ManagementLockListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The URL to use for getting - the next set of results., name: nextLink } - java: { description: The URL to use for getting the - next set of results., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id141 - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: The URL to use for getting - the next set of results., name: ManagementLockListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id016 - operationGroup: *id005 - operationId: ManagementLocks_ListByScope - parameters: - - *id011 - - &id018 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The scope for the lock. When providing - a scope for the assignment, use '/subscriptions/{subscriptionId}' - for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' - for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' - for resources.", name: scope, serializedName: scope } - java: { description: "The scope for the lock. When providing - a scope for the assignment, use '/subscriptions/{subscriptionId}' - for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' - for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' - for resources.", name: scope, serializedName: scope } - nullable: false - operation: *id012 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id017 - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - &id019 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - java: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - nullable: false - operation: *id012 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id017 - - &id020 - apiVersions: [] - flattened: false - implementation: CLIENT - language: - default: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - java: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - nullable: false - operation: *id012 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id128 - apiVersions: [] - language: - default: - { - description: Api Version (2016-09-01), - name: ApiVersion20160901, - } - protocol: {} - type: CONSTANT - value: { value: "2016-09-01" } - valueType: *id015 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id018 - - *id019 - - *id020 - - *id021 - protocol: - http: - { - explode: false, - method: get, - path: "/{scope}/providers/Microsoft.Authorization/locks", - uri: "{$host}", - } - signatureParameters: - - *id018 - - *id019 - responses: *id022 - signatureParameters: - - *id018 - - *id019 - origin: modelerfour:synthesized/host - protocol: - http: { explode: false, in: URI } - required: true - schema: *id015 - - &id025 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource group to lock., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the resource group to lock., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id023 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id031 - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: "", name: String } - maxLength: 90.0 - minLength: 1.0 - pattern: ^[-\w\._\(\)]+$ - protocol: {} - type: STRING - - &id026 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The lock name. The lock name can be a maximum - of 260 characters. It cannot contain <, > %, &, :, \, ?, /, - or any control characters.', name: lockName, serializedName: lockName } - java: { description: 'The lock name. The lock name can be a maximum - of 260 characters. It cannot contain <, > %, &, :, \, ?, /, - or any control characters.', name: lockName, serializedName: lockName } - nullable: false - operation: *id023 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id025 - - *id026 - - *id020 - - *id024 - - &id029 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: The management lock parameters., name: parameters } - java: { description: The management lock parameters., name: parameters } - nullable: false - operation: *id023 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id027 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id023 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName} - uri: "{$host}" - signatureParameters: - - *id025 - - *id026 - - *id029 - responses: - - language: - default: { description: OK - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - - language: - default: - { description: Created - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id027 - signatureParameters: - - *id025 - - *id026 - - &id030 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete management lock at resource group level: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - resourceGroupName: resourcegroupname, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_DeleteAtResourceGroupLevel.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "To delete management locks, you must have - access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: DeleteAtResourceGroupLevel, summary: Deletes a management lock at the resource group level. } - java: { description: "To delete management locks, you must have access - to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: delete } - operationGroup: *id005 - operationId: ManagementLocks_DeleteAtResourceGroupLevel - parameters: - - *id011 - - &id032 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group containing - the lock., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group containing the - lock., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id030 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id031 - - &id033 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of lock to delete., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of lock to delete., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id030 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id032 - - *id033 - - *id020 - - *id024 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id032 - - *id033 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: NoContent, name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id032 - - *id033 - - &id034 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get management lock at resource group level: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - resourceGroupName: resourcegroupname, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtResourceGroupLevel.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets a management lock at the resource group - level., name: GetAtResourceGroupLevel } - java: - { - description: Gets a management lock at the resource group level., - name: getByResourceGroup, - } - operationGroup: *id005 - operationId: ManagementLocks_GetAtResourceGroupLevel - parameters: - - *id011 - - &id035 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the locked resource group., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the locked resource group., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id034 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id031 - - &id036 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the lock to get., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of the lock to get., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id034 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id035 - - *id036 - - *id020 - - *id024 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id034 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id035 - - *id036 - responses: - - language: - default: { description: OK - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id035 - - *id036 - - &id037 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create management lock at scope: - parameters: - api-version: "2016-09-01" - lockName: testlock - parameters: - properties: { level: ReadOnly } - scope: subscriptions/subscriptionId - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_CreateOrUpdateAtScope.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - "201": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { - description: Create or update a management lock by scope., - name: CreateOrUpdateByScope, - } - java: - { - description: Create or update a management lock by scope., - name: createOrUpdateByScope, - } - operationGroup: *id005 - operationId: ManagementLocks_CreateOrUpdateByScope - parameters: - - *id011 - - &id038 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The scope for the lock. When providing a - scope for the assignment, use '/subscriptions/{subscriptionId}' - for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' - for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' - for resources.", name: scope, serializedName: scope } - java: { description: "The scope for the lock. When providing a scope - for the assignment, use '/subscriptions/{subscriptionId}' - for subscriptions, '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}' - for resource groups, and '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePathIfPresent}/{resourceType}/{resourceName}' - for resources.", name: scope, serializedName: scope } - nullable: false - operation: *id037 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id039 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id037 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id038 - - *id039 - - *id020 - - &id040 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Create or update management lock parameters., - name: parameters, - } - java: - { - description: Create or update management lock parameters., - name: parameters, - } - nullable: false - operation: *id037 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id027 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id037 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /{scope}/providers/Microsoft.Authorization/locks/{lockName} - uri: "{$host}" - signatureParameters: - - *id038 - - *id039 - - *id040 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - - language: - default: { description: Created, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id027 - signatureParameters: - - *id038 - - *id039 - - &id041 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete management lock at scope: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - scope: subscriptions/subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_DeleteAtScope.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { description: Delete a management lock by scope., name: DeleteByScope } - java: { description: Delete a management lock by scope., name: deleteByScope } - operationGroup: *id005 - operationId: ManagementLocks_DeleteByScope - parameters: - - *id011 - - &id042 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: "The scope for the lock. ", - name: scope, - serializedName: scope, - } - java: - { - description: "The scope for the lock. ", - name: scope, - serializedName: scope, - } - nullable: false - operation: *id041 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id043 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id041 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id042 - - *id043 - - *id020 - protocol: - http: - { - explode: false, - method: delete, - path: "/{scope}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id042 - - *id043 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: NoContent, name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id042 - - *id043 - - &id044 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get management lock at scope: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - scope: subscriptions/subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtScope.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get a management lock by scope., name: GetByScope } - java: { description: Get a management lock by scope., name: getByScope } - operationGroup: *id005 - operationId: ManagementLocks_GetByScope - parameters: - - *id011 - - &id045 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: "The scope for the lock. ", - name: scope, - serializedName: scope, - } - java: - { - description: "The scope for the lock. ", - name: scope, - serializedName: scope, - } - nullable: false - operation: *id044 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id046 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id044 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id045 - - *id046 - - *id020 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id044 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - { - explode: false, - method: get, - path: "/{scope}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id045 - - *id046 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id045 - - *id046 - - &id047 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create management lock at resource level: - parameters: - api-version: "2016-09-01" - lockName: testlock - parameters: - properties: { level: ReadOnly } - parentResourcePath: parentResourcePath - resourceGroupName: resourcegroupname - resourceName: teststorageaccount - resourceProviderNamespace: Microsoft.Storage - resourceType: storageAccounts - subscriptionId: subscriptionId - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_CreateOrUpdateAtResourceLevel.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - "201": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "When you apply a lock at a parent scope, all - child resources inherit the same lock. To create management locks, - you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: CreateOrUpdateAtResourceLevel, summary: Creates or updates a management lock at the resource level - or any level below the resource. } - java: { description: "When you apply a lock at a parent scope, all - child resources inherit the same lock. To create management locks, - you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: createOrUpdateAtResourceLevel } - operationGroup: *id005 - operationId: ManagementLocks_CreateOrUpdateAtResourceLevel - parameters: - - *id011 - - &id048 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the resource group containing - the resource to lock. ", name: resourceGroupName, serializedName: resourceGroupName } - java: { description: "The name of the resource group containing the - resource to lock. ", name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id031 - - &id049 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The resource provider namespace of the resource - to lock., name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - java: { description: The resource provider namespace of the resource - to lock., name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id050 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The parent resource identity., - name: parentResourcePath, - serializedName: parentResourcePath, - } - java: - { - description: The parent resource identity., - name: parentResourcePath, - serializedName: parentResourcePath, - } - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id051 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The resource type of the resource to lock., - name: resourceType, - serializedName: resourceType, - } - java: - { - description: The resource type of the resource to lock., - name: resourceType, - serializedName: resourceType, - } - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id052 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource to lock., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource to lock., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id053 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The name of lock. The lock name can be a - maximum of 260 characters. It cannot contain <, > %, &, :, \, - ?, /, or any control characters.', name: lockName, serializedName: lockName } - java: { description: 'The name of lock. The lock name can be a maximum - of 260 characters. It cannot contain <, > %, &, :, \, ?, /, - or any control characters.', name: lockName, serializedName: lockName } - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id048 - - *id049 - - *id050 - - *id051 - - *id052 - - *id053 - - *id020 - - *id024 - - &id054 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Parameters for creating or updating a management - lock., name: parameters } - java: { description: Parameters for creating or updating a management - lock., name: parameters } - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id027 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id047 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName} - uri: "{$host}" - signatureParameters: - - *id048 - - *id049 - - *id050 - - *id051 - - *id052 - - *id053 - - *id054 - responses: - - language: - default: { description: OK - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - - language: - default: - { description: Created - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id027 - signatureParameters: - - *id048 - - *id049 - - *id050 - - *id051 - - *id052 - - *id053 - - &id055 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete management lock at resource level: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - parentResourcePath: parentResourcePath, - resourceGroupName: resourcegroupname, - resourceName: teststorageaccount, - resourceProviderNamespace: Microsoft.Storage, - resourceType: storageAccounts, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_DeleteAtResourceLevel.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "To delete management locks, you must have - access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: DeleteAtResourceLevel, summary: Deletes - the management lock of a resource or any level below the resource. } - java: { description: "To delete management locks, you must have access - to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: deleteAtResourceLevel } - operationGroup: *id005 - operationId: ManagementLocks_DeleteAtResourceLevel - parameters: - - *id011 - - &id056 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the resource group containing - the resource with the lock to delete. ", name: resourceGroupName, serializedName: resourceGroupName } - java: { description: "The name of the resource group containing the - resource with the lock to delete. ", name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id031 - - &id057 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The resource provider namespace of the resource - with the lock to delete., name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - java: { description: The resource provider namespace of the resource - with the lock to delete., name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id058 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The parent resource identity., - name: parentResourcePath, - serializedName: parentResourcePath, - } - java: - { - description: The parent resource identity., - name: parentResourcePath, - serializedName: parentResourcePath, - } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id059 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: The resource type of the resource with the - lock to delete., name: resourceType, serializedName: resourceType } - java: { description: The resource type of the resource with the lock - to delete., name: resourceType, serializedName: resourceType } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id060 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource with the lock to - delete., name: resourceName, serializedName: resourceName } - java: - { - description: The name of the resource with the lock to delete., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id061 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the lock to delete., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of the lock to delete., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id056 - - *id057 - - *id058 - - *id059 - - *id060 - - *id061 - - *id020 - - *id024 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id056 - - *id057 - - *id058 - - *id059 - - *id060 - - *id061 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: NoContent, name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id056 - - *id057 - - *id058 - - *id059 - - *id060 - - *id061 - - &id062 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get management lock at resource level: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - parentResourcePath: parentResourcePath, - resourceGroupName: resourcegroupname, - resourceName: teststorageaccount, - resourceProviderNamespace: Microsoft.Storage, - resourceType: storageAccounts, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtResourceLevel.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get the management lock of a resource or any - level below resource., name: GetAtResourceLevel } - java: { description: Get the management lock of a resource or any level - below resource., name: getAtResourceLevel } - operationGroup: *id005 - operationId: ManagementLocks_GetAtResourceLevel - parameters: - - *id011 - - &id063 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: "The name of the resource group. ", - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: "The name of the resource group. ", - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id031 - - &id064 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The namespace of the resource provider., - name: resourceProviderNamespace, - serializedName: resourceProviderNamespace, - } - java: - { - description: The namespace of the resource provider., - name: resourceProviderNamespace, - serializedName: resourceProviderNamespace, - } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id065 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "An extra path parameter needed in some services, - like SQL Databases.", name: parentResourcePath, serializedName: parentResourcePath } - java: { description: "An extra path parameter needed in some services, - like SQL Databases.", name: parentResourcePath, serializedName: parentResourcePath } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id066 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The type of the resource., - name: resourceType, - serializedName: resourceType, - } - java: - { - description: The type of the resource., - name: resourceType, - serializedName: resourceType, - } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id067 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id068 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of lock., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id063 - - *id064 - - *id065 - - *id066 - - *id067 - - *id068 - - *id020 - - *id024 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id062 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id063 - - *id064 - - *id065 - - *id066 - - *id067 - - *id068 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id063 - - *id064 - - *id065 - - *id066 - - *id067 - - *id068 - - &id069 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create management lock at subscription level: - parameters: - api-version: "2016-09-01" - lockName: testlock - parameters: - properties: { level: ReadOnly } - subscriptionId: subscriptionId - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_CreateOrUpdateAtSubscriptionLevel.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - "201": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "When you apply a lock at a parent scope, all - child resources inherit the same lock. To create management locks, - you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: CreateOrUpdateAtSubscriptionLevel, summary: Creates or updates a management lock at the subscription - level. } - java: { description: "When you apply a lock at a parent scope, all - child resources inherit the same lock. To create management locks, - you must have access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: createOrUpdateAtSubscriptionLevel } - operationGroup: *id005 - operationId: ManagementLocks_CreateOrUpdateAtSubscriptionLevel - parameters: - - *id011 - - &id070 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The name of lock. The lock name can be a - maximum of 260 characters. It cannot contain <, > %, &, :, \, - ?, /, or any control characters.', name: lockName, serializedName: lockName } - java: { description: 'The name of lock. The lock name can be a maximum - of 260 characters. It cannot contain <, > %, &, :, \, ?, /, - or any control characters.', name: lockName, serializedName: lockName } - nullable: false - operation: *id069 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id070 - - *id020 - - *id024 - - &id071 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: The management lock parameters., name: parameters } - java: { description: The management lock parameters., name: parameters } - nullable: false - operation: *id069 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id027 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id069 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName} - uri: "{$host}" - signatureParameters: - - *id070 - - *id071 - responses: - - language: - default: { description: OK - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - - language: - default: - { description: Created - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id027 - signatureParameters: - - *id070 - - &id072 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete management lock at subscription level: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_DeleteAtSubscriptionLevel.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "To delete management locks, you must have - access to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: DeleteAtSubscriptionLevel, summary: Deletes the management lock at the subscription level. } - java: { description: "To delete management locks, you must have access - to Microsoft.Authorization/* or Microsoft.Authorization/locks/* - actions. Of the built-in roles, only Owner and User Access Administrator - are granted those actions.", name: deleteAtSubscriptionLevel } - operationGroup: *id005 - operationId: ManagementLocks_DeleteAtSubscriptionLevel - parameters: - - *id011 - - &id073 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of lock to delete., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of lock to delete., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id072 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id073 - - *id020 - - *id024 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id073 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: NoContent, name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id073 - - &id074 - apiVersions: - - { version: "2016-09-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Get management lock at subscription level: - parameters: - { - api-version: "2016-09-01", - lockName: testlock, - resourceGroupName: resourcegroupname, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_GetAtSubscriptionLevel.json - responses: - "200": - body: - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets a management lock at the subscription - level., name: GetAtSubscriptionLevel } - java: - { - description: Gets a management lock at the subscription level., - name: getAtSubscriptionLevel, - } - operationGroup: *id005 - operationId: ManagementLocks_GetAtSubscriptionLevel - parameters: - - *id011 - - &id075 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the lock to get., - name: lockName, - serializedName: lockName, - } - java: - { - description: The name of the lock to get., - name: lockName, - serializedName: lockName, - } - nullable: false - operation: *id074 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id075 - - *id020 - - *id024 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id074 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks/{lockName}", - uri: "{$host}", - } - signatureParameters: - - *id075 - responses: - - language: - default: { description: OK - Returns information about the lock., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id075 - - &id081 - apiVersions: &id076 - - { version: "2016-09-01" } - exceptions: &id077 [] - extensions: &id078 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List management groups at resource group level: - parameters: - { - api-version: "2016-09-01", - resourceGroupName: resourcegroupname, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_ListAtResourceGroupLevel.json - responses: - "200": - body: - value: - - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id080 - $key: listAtResourceGroupLevelNext - apiVersions: *id076 - exceptions: *id077 - extensions: *id078 - language: - java: - { - description: Get the next page of items, - name: listAtResourceGroupLevelNext, - } - operationGroup: *id005 - parameters: [] - requests: - - language: &id084 - default: { description: Gets all the management locks for a - resource group., name: ListAtResourceGroupLevel } - java: { description: Gets all the management locks for a resource - group., name: listByResourceGroup } - parameters: - - &id082 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id079 { name: nextLink, serializedName: nextLink } - java: *id079 - nullable: false - operation: *id080 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id011 - - &id087 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - java: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - nullable: false - operation: *id081 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id082 - responses: &id088 - - language: - default: - { description: OK - Returns an array of resource locks., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id083 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id084 - operationGroup: *id005 - operationId: ManagementLocks_ListAtResourceGroupLevel - parameters: - - *id011 - - &id085 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group containing - the locks to get., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group containing the - locks to get., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id081 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id031 - - &id086 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - java: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - nullable: false - operation: *id081 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id085 - - *id086 - - *id020 - - *id024 - - *id087 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks", - uri: "{$host}", - } - signatureParameters: - - *id085 - - *id086 - responses: *id088 - signatureParameters: - - *id085 - - *id086 - - &id094 - apiVersions: &id089 - - { version: "2016-09-01" } - exceptions: &id090 [] - extensions: &id091 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List management locks at resource level: - parameters: - { - api-version: "2016-09-01", - parentResourcePath: parentResourcePath, - resourceGroupName: resourcegroupname, - resourceName: teststorageaccount, - resourceProviderNamespace: Microsoft.Storage, - resourceType: storageAccounts, - subscriptionId: subscriptionId, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ManagementLocks_ListAtResourceLevel.json - responses: - "200": - body: - value: - - name: testlock - type: Microsoft.Authorization/locks - id: /providers/Microsoft.Authorization/locks/testlock - properties: { level: ReadOnly } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id093 - $key: listAtResourceLevelNext - apiVersions: *id089 - exceptions: *id090 - extensions: *id091 - language: - java: - { - description: Get the next page of items, - name: listAtResourceLevelNext, - } - operationGroup: *id005 - parameters: [] - requests: - - language: &id096 - default: { description: Gets all the management locks for a - resource or any level below resource., name: ListAtResourceLevel } - java: { description: Gets all the management locks for a resource - or any level below resource., name: listAtResourceLevel } - parameters: - - &id095 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id092 { name: nextLink, serializedName: nextLink } - java: *id092 - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id011 - - &id103 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - java: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - nullable: false - operation: *id094 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: - { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id095 - responses: &id104 - - language: - default: - { description: OK - Returns an array of resource locks., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id083 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id096 - operationGroup: *id005 - operationId: ManagementLocks_ListAtResourceLevel - parameters: - - *id011 - - &id097 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group containing - the locked resource. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group containing the - locked resource. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id094 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id031 - - &id098 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The namespace of the resource provider., - name: resourceProviderNamespace, - serializedName: resourceProviderNamespace, - } - java: - { - description: The namespace of the resource provider., - name: resourceProviderNamespace, - serializedName: resourceProviderNamespace, - } - nullable: false - operation: *id094 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id099 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The parent resource identity., - name: parentResourcePath, - serializedName: parentResourcePath, - } - java: - { - description: The parent resource identity., - name: parentResourcePath, - serializedName: parentResourcePath, - } - nullable: false - operation: *id094 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id100 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: - { - description: The resource type of the locked resource., - name: resourceType, - serializedName: resourceType, - } - java: - { - description: The resource type of the locked resource., - name: resourceType, - serializedName: resourceType, - } - nullable: false - operation: *id094 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id101 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the locked resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the locked resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id094 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - &id102 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - java: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - nullable: false - operation: *id094 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id097 - - *id098 - - *id099 - - *id100 - - *id101 - - *id102 - - *id020 - - *id024 - - *id103 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks", - uri: "{$host}", - } - signatureParameters: - - *id097 - - *id098 - - *id099 - - *id100 - - *id101 - - *id102 - responses: *id104 - signatureParameters: - - *id097 - - *id098 - - *id099 - - *id100 - - *id101 - - *id102 - - *id105 - - *id012 - - *id080 - - *id093 - - *id106 - - *id010 - protocol: {} - parameters: [] - requests: - - language: &id109 - default: - { - description: Gets all the management locks for a subscription., - name: ListAtSubscriptionLevel, - } - java: - { description: Gets all the management locks for a subscription., name: list } - parameters: - - &id108 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id107 { name: nextLink, serializedName: nextLink } - java: *id107 - nullable: false - operation: *id106 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id011 - - &id111 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id105 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id108 - responses: &id112 - - language: - default: { description: OK - Returns an array of resource locks., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id083 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id109 - operationGroup: *id005 - operationId: ManagementLocks_ListAtSubscriptionLevel - parameters: - - *id011 - - &id110 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - java: - { - description: The filter to apply on the operation., - name: filter, - serializedName: $filter, - } - nullable: false - operation: *id105 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id017 - - *id020 - - *id024 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id110 - - *id020 - - *id024 - - *id111 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/locks", - uri: "{$host}", - } - signatureParameters: - - *id110 - responses: *id112 - signatureParameters: - - *id110 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id017 - - *id011 - - *id020 -info: { description: Azure resources can be locked to prevent other users in your organization - from deleting or modifying resources., title: ManagementLockClient } -language: - default: { description: "", name: ManagementLockClient } - java: { description: "", name: ManagementLockClient } -operationGroups: - - &id116 - $key: AuthorizationOperations - codeModel: *id004 - language: - default: { description: "", name: AuthorizationOperations } - java: { description: "", name: AuthorizationOperations } - operations: - - &id119 - apiVersions: &id113 - - { version: "2016-09-01" } - exceptions: &id114 [] - extensions: &id115 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List provider operations: - parameters: { api-version: "2016-09-01" } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2016-09-01/examples/ListProviderOperations.json - responses: - "200": - body: - value: - - name: Microsoft.Authorization/locks/read - display: - { operation: read, provider: Microsoft.Authorization, resource: locks } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id118 - $key: listNext - apiVersions: *id113 - exceptions: *id114 - extensions: *id115 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id116 - parameters: [] - requests: - - language: &id121 - default: { description: Lists all of the available Microsoft.Authorization - REST API operations., name: List } - java: { description: Lists all of the available Microsoft.Authorization - REST API operations., name: list } - parameters: - - &id120 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id117 { name: nextLink, serializedName: nextLink } - java: *id117 - nullable: false - operation: *id118 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id011 - - &id122 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id119 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id028 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id120 - responses: &id123 - - language: - default: { description: OK. The request has succeeded., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id129 - apiVersions: - - { version: "2016-09-01" } - flattenedSchema: false - language: - default: { description: Result of the request to list Microsoft.Authorization - operations. It contains a list of operations and a URL link to - get the next set of results., name: OperationListResult, namespace: "" } - java: { description: Result of the request to list Microsoft.Authorization - operations. It contains a list of operations and a URL link to - get the next set of results., name: OperationListResult } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: List of Microsoft.Authorization operations., - name: value, - } - java: - { - description: List of Microsoft.Authorization operations., - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id124 - apiVersions: - - { version: "2016-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id130 - apiVersions: - - { version: "2016-09-01" } - flattenedSchema: false - language: - default: - { - description: Microsoft.Authorization operation, - name: Operation, - namespace: "", - } - java: - { description: Microsoft.Authorization operation, name: Operation } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: "Operation name: {provider}/{resource}/{operation}", - name: name, - } - java: - { - description: "Operation name: {provider}/{resource}/{operation}", - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id134 - apiVersions: - - { version: "2016-09-01" } - language: - default: - { - description: "Operation name: {provider}/{resource}/{operation}", - name: OperationName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The object that represents the operation., - name: display, - } - java: - { - description: The object that represents the operation., - name: display, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id131 - apiVersions: - - { version: "2016-09-01" } - flattenedSchema: false - language: - default: - { - description: The object that represents the operation., - name: OperationDisplay, - namespace: "", - } - java: - { - description: The object that represents the operation., - name: OperationDisplay, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: "Service provider: Microsoft.Authorization", - name: provider, - } - java: - { - description: "Service provider: Microsoft.Authorization", - name: provider, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id135 - apiVersions: - - { version: "2016-09-01" } - language: - default: - { - description: "Service provider: Microsoft.Authorization", - name: OperationDisplayProvider, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provider - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Resource on which the operation - is performed: Profile, endpoint, etc.", name: resource } - java: { description: "Resource on which the operation is - performed: Profile, endpoint, etc.", name: resource } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id136 - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: "Resource on which the operation - is performed: Profile, endpoint, etc.", name: OperationDisplayResource } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resource - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Operation type: Read, write, delete, - etc.", name: operation } - java: { description: "Operation type: Read, write, delete, - etc.", name: operation } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id137 - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: "Operation type: Read, write, - delete, etc.", name: OperationDisplayOperation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: operation - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: display - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: List of Microsoft.Authorization operations., - name: OperationListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: URL to get the next set of operation list - results if there are any., name: nextLink } - java: { description: URL to get the next set of operation list results - if there are any., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id138 - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: URL to get the next set of operation list - results if there are any., name: OperationListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id121 - operationGroup: *id116 - operationId: AuthorizationOperations_List - parameters: - - *id011 - - *id020 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id011 - - *id020 - - *id122 - protocol: - http: - { - explode: false, - method: get, - path: /providers/Microsoft.Authorization/operations, - uri: "{$host}", - } - signatureParameters: [] - responses: *id123 - signatureParameters: [] - - *id118 - protocol: {} - - *id005 -protocol: - http: { explode: false } -schemas: - ands: [] - arrays: - - *id124 - - *id125 - - *id126 - binaries: [] - booleans: [] - byteArrays: [] - chars: [] - choices: - - *id127 - constants: - - *id128 - - *id028 - credentials: [] - dateTimes: [] - dates: [] - dictionaries: [] - durations: [] - flags: [] - groups: [] - numbers: [] - objects: - - *id129 - - *id130 - - *id131 - - *id027 - - *id132 - - *id133 - - *id083 - odataQueries: [] - ors: [] - parameterGroups: [] - sealedChoices: [] - streams: [] - strings: - - *id015 - - *id134 - - *id135 - - *id136 - - *id137 - - *id138 - - *id031 - - *id017 - - *id139 - - *id140 - - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: The resource ID of the lock., name: ManagementLockObjectId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2016-09-01" } - language: - default: - { - description: The resource type of the lock - Microsoft.Authorization/locks., - name: ManagementLockObjectType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2016-09-01" } - language: - default: { description: The name of the lock., name: ManagementLockObjectName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id141 - unixtimes: [] - unknowns: [] - uris: [] - uuids: [] - xors: [] -security: - authenticationRequired: true - schemes: - - scopes: !!set { user_impersonation: null } - type: OAUTH2 diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-policy.yaml b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-policy.yaml deleted file mode 100644 index c14d3c3854..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-policy.yaml +++ /dev/null @@ -1,14097 +0,0 @@ -!!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel &id005 -apiVersions: [] -clients: [] -globalParameters: - - &id052 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattened: false - implementation: CLIENT - language: - default: - { - description: The ID of the target subscription., - name: SubscriptionId, - serializedName: subscriptionId, - } - java: - { - description: The ID of the target subscription., - name: subscriptionId, - serializedName: subscriptionId, - } - nullable: false - operation: &id070 - apiVersions: &id002 - - { version: 2020-07-01-preview } - exceptions: &id003 - - language: - default: { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id006 - apiVersions: - - { version: "2020-09-01" } - - { version: 2020-07-01-preview } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: An error response from a policy operation., - name: CloudError, - namespace: "", - } - java: - { description: An error response from a policy operation., name: ManagementError } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Common error response for all Azure Resource Manager - APIs to return error details for failed operations. (This also follows - the OData error response format.), name: error } - java: { description: Common error response for all Azure Resource Manager - APIs to return error details for failed operations. (This also follows - the OData error response format.), name: error } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id001 - apiVersions: - - { version: "1.0" } - flattenedSchema: false - language: - default: { description: Common error response for all Azure Resource - Manager APIs to return error details for failed operations. (This - also follows the OData error response format.), name: ErrorResponse, namespace: "", summary: Error Response } - java: { description: Common error response for all Azure Resource Manager - APIs to return error details for failed operations. (This also follows - the OData error response format.), name: ManagementError } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error code., name: code } - java: { description: The error code., name: code } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id409 - apiVersions: - - { version: "1.0" } - language: - default: { description: The error code., name: ErrorResponseCode } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: code - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error message., name: message } - java: { description: The error message., name: message } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id410 - apiVersions: - - { version: "1.0" } - language: - default: { description: The error message., name: ErrorResponseMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error target., name: target } - java: { description: The error target., name: target } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id411 - apiVersions: - - { version: "1.0" } - language: - default: { description: The error target., name: ErrorResponseTarget } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: target - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The error details., name: details } - java: { description: The error details., name: details } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id346 - apiVersions: - - { version: "1.0" } - elementType: *id001 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: The error details., name: ErrorResponseDetails } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: details - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The error additional info., name: additionalInfo } - java: { description: The error additional info., name: additionalInfo } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id347 - apiVersions: - - { version: "1.0" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema - apiVersions: - - { version: "1.0" } - flattenedSchema: false - language: - default: { description: The resource management error additional - info., name: ErrorAdditionalInfo, namespace: "" } - java: - { - description: The resource management error additional info., - name: ErrorAdditionalInfo, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The additional info type., name: type } - java: { description: The additional info type., name: type } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id412 - apiVersions: - - { version: "1.0" } - language: - default: - { - description: The additional info type., - name: ErrorAdditionalInfoType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The additional info., name: info } - java: { description: The additional info., name: info } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.AnySchema &id018 - apiVersions: [] - language: - default: { description: Any object, name: AnyObject } - protocol: {} - type: ANY_OBJECT - serializedName: info - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The error additional info., - name: ErrorResponseAdditionalInfo, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: additionalInfo - protocol: {} - stronglyTypedHeader: false - summary: Error Response - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - serializedName: error - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - extensions: &id004 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List all policy exemptions that apply to a resource: - parameters: - { - api-version: 2020-07-01-preview, - parentResourcePath: virtualMachines/MyTestVm, - resourceGroupName: TestResourceGroup, - resourceName: MyTestComputer.cloudapp.net, - resourceProviderNamespace: Microsoft.Compute, - resourceType: domainNames, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/preview/2020-07-01-preview/examples/listPolicyExemptionsForResource.json - responses: - "200": - body: - value: - - name: DemoExpensiveVMGroup - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVMGroup - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive VM demo } - policyAssignmentId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - - name: jumpBoxExemption - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Compute/virtualMachines/MyTestVm/providers/Microsoft.Authorization/policyExemptions/jumpBoxExemption - properties: - description: Exempt jump box open ports from limit ports policy - displayName: Exempt jump box open ports - exemptionCategory: Mitigated - metadata: { reason: Need to open RDP port to corp net } - policyAssignmentId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/LimitPorts - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id071 - $key: listForResourceNext - apiVersions: *id002 - exceptions: *id003 - extensions: *id004 - language: - java: { description: Get the next page of items, name: listForResourceNext } - operationGroup: &id007 - $key: PolicyExemptions - codeModel: *id005 - language: - default: { description: "", name: PolicyExemptions } - java: { description: "", name: PolicyExemptions } - operations: - - &id026 - apiVersions: - - { version: 2020-07-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation - failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete a policy exemption: - parameters: - { - api-version: 2020-07-01-preview, - policyExemptionName: DemoExpensiveVM, - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/preview/2020-07-01-preview/examples/deletePolicyExemption.json - responses: - "200": - headers: {} - "204": - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "This operation deletes a policy exemption, - given its name and the scope it was created in. The scope of a - policy exemption is the part of its ID preceding '/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'.", name: Delete, summary: Deletes a policy exemption. } - java: { description: "This operation deletes a policy exemption, given - its name and the scope it was created in. The scope of a policy - exemption is the part of its ID preceding '/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}'.", name: delete } - operationGroup: *id007 - operationId: PolicyExemptions_Delete - parameters: - - &id013 - apiVersions: [] - clientDefaultValue: https://management.azure.com - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: CLIENT - language: - default: - { description: server parameter, name: endpoint, serializedName: $host } - java: - { description: server parameter, name: endpoint, serializedName: $host } - nullable: false - operation: &id014 - apiVersions: &id008 - - { version: 2020-07-01-preview } - exceptions: &id009 - - language: - default: { description: Error response describing why the operation - failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id010 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy exemptions that apply to a management group: - parameters: - { - $filter: atScope(), - api-version: 2020-07-01-preview, - managementGroupId: DevOrg, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/preview/2020-07-01-preview/examples/listPolicyExemptionsForManagementGroup.json - responses: - "200": - body: - value: - - name: ResearchBudgetExemption - type: Microsoft.Authorization/policyExemptions - id: /providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyExemptions/ResearchBudgetExemption - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive - VM demo } - policyAssignmentId: /providers/Microsoft.Management/managementGroups/HardwareDivision/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - - name: VNetIsMonitored - type: Microsoft.Authorization/policyExemptions - id: /providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyExemptions/VNetIsMonitored - properties: - description: Exempt jump box open ports from limit - ports policy - displayName: Exempt jump box open ports - exemptionCategory: Mitigated - metadata: { reason: Need to open RDP port to corp - net } - policyAssignmentId: /providers/Microsoft.Management/managementGroups/HardwareDivision/providers/Microsoft.Authorization/policyAssignments/LimitPorts - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id012 - $key: listForManagementGroupNext - apiVersions: *id008 - exceptions: *id009 - extensions: *id010 - language: - java: - { - description: Get the next page of items, - name: listForManagementGroupNext, - } - operationGroup: *id007 - parameters: [] - requests: - - language: &id020 - default: { description: "This operation retrieves the list - of all policy exemptions applicable to the management - group that match the given $filter. Valid values for - $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter=atScope() - is provided, the returned list includes all policy - exemptions that are assigned to the management group - or the management group's ancestors.", name: ListForManagementGroup, summary: Retrieves all policy exemptions that apply - to a management group. } - java: { description: "This operation retrieves the list - of all policy exemptions applicable to the management - group that match the given $filter. Valid values for - $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter=atScope() - is provided, the returned list includes all policy - exemptions that are assigned to the management group - or the management group's ancestors.", name: listForManagementGroup } - parameters: - - &id015 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id011 { name: nextLink, serializedName: nextLink } - java: *id011 - nullable: false - operation: *id012 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id024 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - java: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - nullable: false - operation: *id014 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id032 - apiVersions: [] - language: - default: - { - description: "Accept: application/json", - name: Accept, - } - protocol: {} - type: CONSTANT - value: { value: application/json } - valueType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id017 - apiVersions: [] - language: - default: { description: simple string, name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: - http: - { - explode: false, - method: get, - path: "{nextLink}", - uri: "{$host}", - } - signatureParameters: - - *id015 - responses: &id025 - - language: - default: { description: OK - Returns an array of policy - exemptions., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id050 - apiVersions: - - { version: 2020-07-01-preview } - flattenedSchema: false - language: - default: - { - description: List of policy exemptions., - name: PolicyExemptionListResult, - namespace: "", - } - java: - { - description: List of policy exemptions., - name: PolicyExemptionListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: An array of policy exemptions., - name: value, - } - java: - { - description: An array of policy exemptions., - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id359 - apiVersions: - - { version: 2020-07-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id037 - apiVersions: - - { version: 2020-07-01-preview } - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: The policy exemption., - name: PolicyExemption, - namespace: "", - } - java: - { - description: The policy exemption., - name: PolicyExemption, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id016 - apiVersions: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - java: { name: ProxyResource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - java: { description: the fully qualified - resource ID for the resource, name: id } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: the name of the resource, - name: name, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: the type of the resource, - name: type, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: type - stronglyTypedHeader: false - immediate: - - *id016 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Properties for the policy - exemption., name: properties } - java: { description: Properties for the policy - exemption., name: properties } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id389 - apiVersions: - - { version: 2020-07-01-preview } - flattenedSchema: true - language: - default: { description: The policy exemption - properties., name: PolicyExemptionProperties, namespace: "" } - java: - { - description: The policy exemption properties., - name: PolicyExemptionProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The ID of the policy - assignment that is being exempted., name: policyAssignmentId } - java: { description: The ID of the policy - assignment that is being exempted., name: policyAssignmentId } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id443 - apiVersions: - - { version: 2020-07-01-preview } - language: - default: - { description: The ID of the policy - assignment that is being exempted., name: PolicyExemptionPropertiesPolicyAssignmentId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: policyAssignmentId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The policy definition - reference ID list when the associated - policy assignment is an assignment of - a policy set definition., name: policyDefinitionReferenceIds } - java: { description: The policy definition - reference ID list when the associated - policy assignment is an assignment of - a policy set definition., name: policyDefinitionReferenceIds } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id358 - apiVersions: - - { version: 2020-07-01-preview } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id444 - apiVersions: - - { version: 2020-07-01-preview } - language: - default: - { - description: "", - name: PolicyExemptionPropertiesPolicyDefinitionReferenceIdsItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: The policy definition - reference ID list when the associated - policy assignment is an assignment - of a policy set definition., name: PolicyExemptionPropertiesPolicyDefinitionReferenceIds } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: policyDefinitionReferenceIds - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy exemption - category. Possible values are Waiver - and Mitigated., name: exemptionCategory } - java: { description: The policy exemption - category. Possible values are Waiver - and Mitigated., name: exemptionCategory } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id367 - apiVersions: - - { version: 2020-07-01-preview } - choiceType: *id017 - choices: - - language: - default: { description: This category - of exemptions usually means the - scope is not applicable for the - policy., name: WAIVER } - value: Waiver - - language: - default: { description: This category - of exemptions usually means the - mitigation actions have been applied - to the scope., name: MITIGATED } - value: Mitigated - language: - default: - { description: The policy exemption - category. Possible values are Waiver - and Mitigated., name: ExemptionCategory } - java: { description: The policy exemption - category. Possible values are Waiver - and Mitigated., name: ExemptionCategory } - protocol: {} - type: CHOICE - serializedName: exemptionCategory - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The expiration date - and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) - of the policy exemption.", name: expiresOn } - java: { description: "The expiration date - and time (in UTC ISO 8601 format yyyy-MM-ddTHH:mm:ssZ) - of the policy exemption.", name: expiresOn } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id368 - apiVersions: - - { version: 2020-07-01-preview } - format: DATE_TIME - language: - default: { description: "The expiration - date and time (in UTC ISO 8601 format - yyyy-MM-ddTHH:mm:ssZ) of the policy - exemption.", name: PolicyExemptionPropertiesExpiresOn } - protocol: {} - type: DATE_TIME - serializedName: expiresOn - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The display name - of the policy exemption., name: displayName } - java: { description: The display name of - the policy exemption., name: displayName } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id445 - apiVersions: - - { version: 2020-07-01-preview } - language: - default: { description: The display name - of the policy exemption., name: PolicyExemptionPropertiesDisplayName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The description of - the policy exemption., name: description } - java: { description: The description of the - policy exemption., name: description } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id446 - apiVersions: - - { version: 2020-07-01-preview } - language: - default: { description: The description - of the policy exemption., name: PolicyExemptionPropertiesDescription } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy exemption - metadata. Metadata is an open ended - object and is typically a collection - of key value pairs., name: metadata } - java: { description: The policy exemption - metadata. Metadata is an open ended - object and is typically a collection - of key value pairs., name: metadata } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: metadata - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Azure Resource Manager - metadata containing createdBy and modifiedBy - information., name: systemData } - java: - { description: Azure Resource Manager metadata - containing createdBy and modifiedBy information., name: systemData } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id390 - apiVersions: - - { version: "2.0" } - flattenedSchema: false - language: - default: { description: Metadata pertaining - to creation and last modification of the - resource., name: SystemData, namespace: "" } - java: { description: Metadata pertaining to - creation and last modification of the - resource., name: SystemData } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The identity that - created the resource., name: createdBy } - java: - { description: The identity that created - the resource., name: createdBy } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id447 - apiVersions: - - { version: "2.0" } - language: - default: { description: The identity that - created the resource., name: SystemDataCreatedBy } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: createdBy - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The type of identity - that created the resource., name: createdByType } - java: { description: The type of identity - that created the resource., name: createdByType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id019 - apiVersions: - - { version: "2.0" } - choiceType: *id017 - choices: - - language: - default: - { description: "", name: USER } - value: User - - language: - default: - { - description: "", - name: APPLICATION, - } - value: Application - - language: - default: - { - description: "", - name: MANAGED_IDENTITY, - } - value: ManagedIdentity - - language: - default: - { description: "", name: KEY } - value: Key - language: - default: - { description: The type of identity - that created the resource., name: CreatedByType } - java: { description: The type of identity - that created the resource., name: CreatedByType } - protocol: {} - type: CHOICE - serializedName: createdByType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The timestamp of - resource creation (UTC)., name: createdAt } - java: - { description: The timestamp of resource - creation (UTC)., name: createdAt } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id369 - apiVersions: - - { version: "2.0" } - format: DATE_TIME - language: - default: { description: The timestamp of - resource creation (UTC)., name: SystemDataCreatedAt } - protocol: {} - type: DATE_TIME - serializedName: createdAt - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The identity that - last modified the resource., name: lastModifiedBy } - java: { description: The identity that last - modified the resource., name: lastModifiedBy } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id448 - apiVersions: - - { version: "2.0" } - language: - default: { description: The identity that - last modified the resource., name: SystemDataLastModifiedBy } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: lastModifiedBy - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The type of identity - that last modified the resource., name: lastModifiedByType } - java: { description: The type of identity - that last modified the resource., name: lastModifiedByType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id019 - serializedName: lastModifiedByType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The timestamp of - resource last modification (UTC), name: lastModifiedAt } - java: - { description: The timestamp of resource - last modification (UTC), name: lastModifiedAt } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id370 - apiVersions: - - { version: "2.0" } - format: DATE_TIME - language: - default: { description: The timestamp of - resource last modification (UTC), name: SystemDataLastModifiedAt } - protocol: {} - type: DATE_TIME - serializedName: lastModifiedAt - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: systemData - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: An array of policy exemptions., - name: PolicyExemptionListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The URL to use for getting - the next set of results., name: nextLink } - java: { description: The URL to use for getting the - next set of results., name: nextLink } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id449 - apiVersions: - - { version: 2020-07-01-preview } - language: - default: { description: The URL to use for getting - the next set of results., name: PolicyExemptionListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id020 - operationGroup: *id007 - operationId: PolicyExemptions_ListForManagementGroup - parameters: - - *id013 - - &id021 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id014 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id085 - apiVersions: - - { version: "2020-09-01" } - - { version: 2020-07-01-preview } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - &id022 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. - Valid values for $filter are: 'atScope()', 'atExactScope()', - 'excludeExpired()' or 'policyAssignmentId eq '{value}''. - If $filter is not provided, no filtering is performed. If - $filter is not provided, the unfiltered list includes all - policy exemptions associated with the scope, including those - that apply directly or apply from containing scopes. If - $filter=atScope() is provided, the returned list only includes - all policy exemptions that apply to the scope, which is - everything in the unfiltered list except those applied to - sub scopes contained within the given scope. If $filter=atExactScope() - is provided, the returned list only includes all policy - exemptions that at the given scope. If $filter=excludeExpired() - is provided, the returned list only includes all policy - exemptions that either haven't expired or didn't set expiration - date. If $filter=policyAssignmentId eq '{value}' is provided. - the returned list only includes all policy exemptions that - are associated with the give policyAssignmentId.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid - values for $filter are: 'atScope()', 'atExactScope()', - 'excludeExpired()' or 'policyAssignmentId eq '{value}''. - If $filter is not provided, no filtering is performed. If - $filter is not provided, the unfiltered list includes all - policy exemptions associated with the scope, including those - that apply directly or apply from containing scopes. If - $filter=atScope() is provided, the returned list only includes - all policy exemptions that apply to the scope, which is - everything in the unfiltered list except those applied to - sub scopes contained within the given scope. If $filter=atExactScope() - is provided, the returned list only includes all policy - exemptions that at the given scope. If $filter=excludeExpired() - is provided, the returned list only includes all policy - exemptions that either haven't expired or didn't set expiration - date. If $filter=policyAssignmentId eq '{value}' is provided. - the returned list only includes all policy exemptions that - are associated with the give policyAssignmentId.", name: filter, serializedName: $filter } - nullable: false - operation: *id014 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id027 - apiVersions: - - { version: 2020-07-01-preview } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - &id023 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - java: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - nullable: false - operation: *id014 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id028 - apiVersions: [] - language: - default: - { - description: Api Version (2020-07-01-preview), - name: ApiVersion20200701Preview, - } - protocol: {} - type: CONSTANT - value: { value: 2020-07-01-preview } - valueType: *id017 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id021 - - *id022 - - *id023 - - *id024 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions", - uri: "{$host}", - } - signatureParameters: - - *id021 - - *id022 - responses: *id025 - signatureParameters: - - *id021 - - *id022 - origin: modelerfour:synthesized/host - protocol: - http: { explode: false, in: URI } - required: true - schema: *id017 - - &id029 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The scope of the policy exemption. Valid - scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), - resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - java: { description: "The scope of the policy exemption. Valid scopes - are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), - resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - nullable: false - operation: *id026 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id030 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy exemption to delete., - name: policyExemptionName, - serializedName: policyExemptionName, - } - java: - { - description: The name of the policy exemption to delete., - name: policyExemptionName, - serializedName: policyExemptionName, - } - nullable: false - operation: *id026 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id031 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - java: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - nullable: false - operation: *id026 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id028 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id029 - - *id030 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id026 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: delete, - path: "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}", - uri: "{$host}", - } - signatureParameters: - - *id029 - - *id030 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content - the policy exemption doesn't - exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id029 - - *id030 - - &id033 - apiVersions: - - { version: 2020-07-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation - failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create or update a policy exemption: - parameters: - api-version: 2020-07-01-preview - parameters: - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive - VM demo } - policyAssignmentId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - policyExemptionName: DemoExpensiveVM - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/preview/2020-07-01-preview/examples/createOrUpdatePolicyExemption.json - responses: - "200": - body: - name: DemoExpensiveVM - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive - VM demo } - policyAssignmentId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: {} - "201": - body: - name: DemoExpensiveVM - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive - VM demo } - policyAssignmentId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T01:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: " This operation creates or updates a policy - exemption with the given scope and name. Policy exemptions apply - to all resources contained within their scope. For example, when - you create a policy exemption at resource group scope for a policy - assignment at the same or above level, the exemption exempts to - all applicable resources in the resource group.", name: CreateOrUpdate, summary: Creates or updates a policy exemption. } - java: { description: " This operation creates or updates a policy exemption - with the given scope and name. Policy exemptions apply to all - resources contained within their scope. For example, when you - create a policy exemption at resource group scope for a policy - assignment at the same or above level, the exemption exempts to - all applicable resources in the resource group.", name: createOrUpdate } - operationGroup: *id007 - operationId: PolicyExemptions_CreateOrUpdate - parameters: - - *id013 - - &id034 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The scope of the policy exemption. Valid - scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), - resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - java: { description: "The scope of the policy exemption. Valid scopes - are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), - resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - nullable: false - operation: *id033 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id035 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy exemption to delete., - name: policyExemptionName, - serializedName: policyExemptionName, - } - java: - { - description: The name of the policy exemption to delete., - name: policyExemptionName, - serializedName: policyExemptionName, - } - nullable: false - operation: *id033 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id036 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - java: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - nullable: false - operation: *id033 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id028 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id034 - - *id035 - - *id036 - - &id038 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Parameters for the policy exemption., - name: parameters, - } - java: - { - description: Parameters for the policy exemption., - name: parameters, - } - nullable: false - operation: *id033 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id037 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id033 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName} - uri: "{$host}" - signatureParameters: - - *id034 - - *id035 - - *id038 - responses: - - language: - default: { description: OK - Returns information about the updated - policy exemption., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id037 - - language: - default: { description: Created - Returns information about the new - policy exemption., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id037 - signatureParameters: - - *id034 - - *id035 - - &id039 - apiVersions: - - { version: 2020-07-01-preview } - exceptions: - - language: - default: { description: Error response describing why the operation - failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a policy exemption: - parameters: - { - api-version: 2020-07-01-preview, - policyExemptionName: DemoExpensiveVM, - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/preview/2020-07-01-preview/examples/getPolicyExemption.json - responses: - "200": - body: - name: DemoExpensiveVM - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/demoCluster/providers/Microsoft.Authorization/policyExemptions/DemoExpensiveVM - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive - VM demo } - policyAssignmentId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "This operation retrieves a single policy exemption, - given its name and the scope it was created at.", name: Get, summary: Retrieves - a policy exemption. } - java: { description: "This operation retrieves a single policy exemption, - given its name and the scope it was created at.", name: get } - operationGroup: *id007 - operationId: PolicyExemptions_Get - parameters: - - *id013 - - &id040 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The scope of the policy exemption. Valid - scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), - resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - java: { description: "The scope of the policy exemption. Valid scopes - are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), - resource group (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - nullable: false - operation: *id039 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id041 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy exemption to delete., - name: policyExemptionName, - serializedName: policyExemptionName, - } - java: - { - description: The name of the policy exemption to delete., - name: policyExemptionName, - serializedName: policyExemptionName, - } - nullable: false - operation: *id039 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id042 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - java: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - nullable: false - operation: *id039 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id028 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id040 - - *id041 - - *id042 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id039 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/{scope}/providers/Microsoft.Authorization/policyExemptions/{policyExemptionName}", - uri: "{$host}", - } - signatureParameters: - - *id040 - - *id041 - responses: - - language: - default: { description: OK - Returns information about the policy - exemption., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id037 - signatureParameters: - - *id040 - - *id041 - - &id048 - apiVersions: &id043 - - { version: 2020-07-01-preview } - exceptions: &id044 - - language: - default: { description: Error response describing why the operation - failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id045 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy exemptions that apply to a subscription: - parameters: - { - $filter: atScope(), - api-version: 2020-07-01-preview, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/preview/2020-07-01-preview/examples/listPolicyExemptionsForSubscription.json - responses: - "200": - body: - value: - - name: TestVMSub - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyExemptions/TestVMSub - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive - VM demo } - policyAssignmentId: /providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - - name: TestVNetSub - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyExemptions/TestVNetSub - properties: - description: Exempt jump box open ports from limit - ports policy - displayName: Exempt jump box open ports - exemptionCategory: Mitigated - metadata: { reason: Need to open RDP port to corp net } - policyAssignmentId: /providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyAssignments/LimitPorts - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id047 - $key: listNext - apiVersions: *id043 - exceptions: *id044 - extensions: *id045 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id007 - parameters: [] - requests: - - language: &id051 - default: { description: "This operation retrieves the list - of all policy exemptions associated with the given subscription - that match the optional given $filter. Valid values for - $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is - not provided, the unfiltered list includes all policy - exemptions associated with the subscription, including - those that apply directly or from management groups that - contain the given subscription, as well as any applied - to objects contained within the subscription.", name: List, summary: Retrieves all policy exemptions that apply to a - subscription. } - java: { description: "This operation retrieves the list of - all policy exemptions associated with the given subscription - that match the optional given $filter. Valid values for - $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is - not provided, the unfiltered list includes all policy - exemptions associated with the subscription, including - those that apply directly or from management groups that - contain the given subscription, as well as any applied - to objects contained within the subscription.", name: list } - parameters: - - &id049 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id046 { name: nextLink, serializedName: nextLink } - java: *id046 - nullable: false - operation: *id047 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id055 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - java: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - nullable: false - operation: *id048 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id049 - responses: &id056 - - language: - default: - { - description: OK - Returns an array of policy exemptions., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id050 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id051 - operationGroup: *id007 - operationId: PolicyExemptions_List - parameters: - - *id013 - - *id052 - - &id053 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid - values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is not - provided, no filtering is performed. If $filter is not provided, - the unfiltered list includes all policy exemptions associated - with the scope, including those that apply directly or apply - from containing scopes. If $filter=atScope() is provided, the - returned list only includes all policy exemptions that apply - to the scope, which is everything in the unfiltered list except - those applied to sub scopes contained within the given scope. - If $filter=atExactScope() is provided, the returned list only - includes all policy exemptions that at the given scope. If $filter=excludeExpired() - is provided, the returned list only includes all policy exemptions - that either haven't expired or didn't set expiration date. - If $filter=policyAssignmentId eq '{value}' is provided. the - returned list only includes all policy exemptions that are associated - with the give policyAssignmentId.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid - values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is not - provided, no filtering is performed. If $filter is not provided, - the unfiltered list includes all policy exemptions associated - with the scope, including those that apply directly or apply - from containing scopes. If $filter=atScope() is provided, the - returned list only includes all policy exemptions that apply - to the scope, which is everything in the unfiltered list except - those applied to sub scopes contained within the given scope. - If $filter=atExactScope() is provided, the returned list only - includes all policy exemptions that at the given scope. If $filter=excludeExpired() - is provided, the returned list only includes all policy exemptions - that either haven't expired or didn't set expiration date. - If $filter=policyAssignmentId eq '{value}' is provided. the - returned list only includes all policy exemptions that are associated - with the give policyAssignmentId.", name: filter, serializedName: $filter } - nullable: false - operation: *id048 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id027 - - &id054 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - java: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - nullable: false - operation: *id048 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id028 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id052 - - *id053 - - *id054 - - *id055 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyExemptions", - uri: "{$host}", - } - signatureParameters: - - *id053 - responses: *id056 - signatureParameters: - - *id053 - - &id062 - apiVersions: &id057 - - { version: 2020-07-01-preview } - exceptions: &id058 - - language: - default: { description: Error response describing why the operation - failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id059 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy exemptions that apply to a resource group: - parameters: - { - $filter: atScope(), - api-version: 2020-07-01-preview, - resourceGroupName: TestResourceGroup, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/preview/2020-07-01-preview/examples/listPolicyExemptionsForResourceGroup.json - responses: - "200": - body: - value: - - name: TestVMSub - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyExemptions/TestVMSub - properties: - description: Exempt demo cluster from limit sku - displayName: Exempt demo cluster - exemptionCategory: Waiver - metadata: { reason: Temporary exemption for a expensive - VM demo } - policyAssignmentId: /providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyAssignments/CostManagement - policyDefinitionReferenceIds: [Limit_Skus] - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - - name: TestVNetRG - type: Microsoft.Authorization/policyExemptions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyExemptions/TestVNetRG - properties: - description: Exempt jump box open ports from limit - ports policy - displayName: Exempt jump box open ports - exemptionCategory: Mitigated - metadata: { reason: Need to open RDP port to corp net } - policyAssignmentId: /providers/Microsoft.Management/managementGroups/DevOrg/providers/Microsoft.Authorization/policyAssignments/LimitPorts - systemData: - { - createdAt: "2020-07-01T01:01:01.1075056Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2020-07-01T02:01:01.1075056Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id061 - $key: listForResourceGroupNext - apiVersions: *id057 - exceptions: *id058 - extensions: *id059 - language: - java: - { - description: Get the next page of items, - name: listForResourceGroupNext, - } - operationGroup: *id007 - parameters: [] - requests: - - language: &id064 - default: { description: "This operation retrieves the list - of all policy exemptions associated with the given resource - group in the given subscription that match the optional - given $filter. Valid values for $filter are: 'atScope()', - 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId - eq '{value}''. If $filter is not provided, the unfiltered - list includes all policy exemptions associated with the - resource group, including those that apply directly or - apply from containing scopes, as well as any applied to - resources contained within the resource group.", name: ListForResourceGroup, summary: Retrieves all policy exemptions that apply to a - resource group. } - java: { description: "This operation retrieves the list of - all policy exemptions associated with the given resource - group in the given subscription that match the optional - given $filter. Valid values for $filter are: 'atScope()', - 'atExactScope()', 'excludeExpired()' or 'policyAssignmentId - eq '{value}''. If $filter is not provided, the unfiltered - list includes all policy exemptions associated with the - resource group, including those that apply directly or - apply from containing scopes, as well as any applied to - resources contained within the resource group.", name: listByResourceGroup } - parameters: - - &id063 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id060 { name: nextLink, serializedName: nextLink } - java: *id060 - nullable: false - operation: *id061 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id068 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - java: - { - description: Accept header, - name: accept, - serializedName: Accept, - } - nullable: false - operation: *id062 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id063 - responses: &id069 - - language: - default: - { - description: OK - Returns an array of policy exemptions., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id050 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id064 - operationGroup: *id007 - operationId: PolicyExemptions_ListForResourceGroup - parameters: - - *id013 - - *id052 - - &id065 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group containing - the resource., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group containing the - resource., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id075 - apiVersions: - - { version: 2020-07-01-preview } - language: - default: { description: "", name: String } - maxLength: 90.0 - minLength: 1.0 - pattern: ^[-\w\._\(\)]+$ - protocol: {} - type: STRING - - &id066 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid - values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is not - provided, no filtering is performed. If $filter is not provided, - the unfiltered list includes all policy exemptions associated - with the scope, including those that apply directly or apply - from containing scopes. If $filter=atScope() is provided, the - returned list only includes all policy exemptions that apply - to the scope, which is everything in the unfiltered list except - those applied to sub scopes contained within the given scope. - If $filter=atExactScope() is provided, the returned list only - includes all policy exemptions that at the given scope. If $filter=excludeExpired() - is provided, the returned list only includes all policy exemptions - that either haven't expired or didn't set expiration date. - If $filter=policyAssignmentId eq '{value}' is provided. the - returned list only includes all policy exemptions that are associated - with the give policyAssignmentId.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid - values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is not - provided, no filtering is performed. If $filter is not provided, - the unfiltered list includes all policy exemptions associated - with the scope, including those that apply directly or apply - from containing scopes. If $filter=atScope() is provided, the - returned list only includes all policy exemptions that apply - to the scope, which is everything in the unfiltered list except - those applied to sub scopes contained within the given scope. - If $filter=atExactScope() is provided, the returned list only - includes all policy exemptions that at the given scope. If $filter=excludeExpired() - is provided, the returned list only includes all policy exemptions - that either haven't expired or didn't set expiration date. - If $filter=policyAssignmentId eq '{value}' is provided. the - returned list only includes all policy exemptions that are associated - with the give policyAssignmentId.", name: filter, serializedName: $filter } - nullable: false - operation: *id062 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id027 - - &id067 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - java: - { - description: Api Version, - name: apiVersion, - serializedName: api-version, - } - nullable: false - operation: *id062 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id028 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id052 - - *id065 - - *id066 - - *id067 - - *id068 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions", - uri: "{$host}", - } - signatureParameters: - - *id065 - - *id066 - responses: *id069 - signatureParameters: - - *id065 - - *id066 - - *id070 - - *id014 - - *id047 - - *id061 - - *id071 - - *id012 - protocol: {} - parameters: [] - requests: - - language: &id074 - default: { description: "This operation retrieves the list of all policy - exemptions associated with the specified resource in the given resource - group and subscription that match the optional given $filter. Valid - values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is not provided, - the unfiltered list includes all policy exemptions associated with - the resource, including those that apply directly or from all containing - scopes, as well as any applied to resources contained within the - resource. Three parameters plus the resource name are used to identify - a specific resource. If the resource is not part of a parent resource - (the more common case), the parent resource path should not be provided - (or provided as ''). For example a web app could be specified - as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} - == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). - If the resource is part of a parent resource, then all parameters - should be provided. For example a virtual machine DNS name could - be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', - {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} - == 'domainNames', {resourceName} == 'MyComputerName'). A convenient - alternative to providing the namespace and type name separately - is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} - == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', - {resourceName} == 'MyWebApp').", name: ListForResource, summary: Retrieves - all policy exemptions that apply to a resource. } - java: { description: "This operation retrieves the list of all policy - exemptions associated with the specified resource in the given resource - group and subscription that match the optional given $filter. Valid - values for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is not provided, - the unfiltered list includes all policy exemptions associated with - the resource, including those that apply directly or from all containing - scopes, as well as any applied to resources contained within the - resource. Three parameters plus the resource name are used to identify - a specific resource. If the resource is not part of a parent resource - (the more common case), the parent resource path should not be provided - (or provided as ''). For example a web app could be specified - as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} - == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). - If the resource is part of a parent resource, then all parameters - should be provided. For example a virtual machine DNS name could - be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', - {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} - == 'domainNames', {resourceName} == 'MyComputerName'). A convenient - alternative to providing the namespace and type name separately - is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} - == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', - {resourceName} == 'MyWebApp').", name: listForResource } - parameters: - - &id073 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id072 { name: nextLink, serializedName: nextLink } - java: *id072 - nullable: false - operation: *id071 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id083 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id070 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id073 - responses: &id084 - - language: - default: { description: OK - Returns an array of policy exemptions., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id050 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id074 - operationGroup: *id007 - operationId: PolicyExemptions_ListForResource - parameters: - - *id013 - - *id052 - - &id076 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource group containing the resource., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the resource group containing the resource., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id070 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id075 - - &id077 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The namespace of the resource provider. For example, - the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines)", name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - java: { description: "The namespace of the resource provider. For example, - the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines)", name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - nullable: false - operation: *id070 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id078 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: The parent resource path. Use empty string if there - is none., name: parentResourcePath, serializedName: parentResourcePath } - java: { description: The parent resource path. Use empty string if there is - none., name: parentResourcePath, serializedName: parentResourcePath } - nullable: false - operation: *id070 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id079 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: The resource type name. For example the type name of - a web app is 'sites' (from Microsoft.Web/sites)., name: resourceType, serializedName: resourceType } - java: { description: The resource type name. For example the type name of a - web app is 'sites' (from Microsoft.Web/sites)., name: resourceType, serializedName: resourceType } - nullable: false - operation: *id070 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id080 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id070 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id027 - - &id081 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' - or 'policyAssignmentId eq '{value}''. If $filter is not provided, - no filtering is performed. If $filter is not provided, the unfiltered - list includes all policy exemptions associated with the scope, including - those that apply directly or apply from containing scopes. If $filter=atScope() - is provided, the returned list only includes all policy exemptions that - apply to the scope, which is everything in the unfiltered list except - those applied to sub scopes contained within the given scope. If $filter=atExactScope() - is provided, the returned list only includes all policy exemptions that - at the given scope. If $filter=excludeExpired() is provided, the returned - list only includes all policy exemptions that either haven't expired - or didn't set expiration date. If $filter=policyAssignmentId eq '{value}' - is provided. the returned list only includes all policy exemptions that - are associated with the give policyAssignmentId.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atScope()', 'atExactScope()', 'excludeExpired()' or - 'policyAssignmentId eq '{value}''. If $filter is not provided, no - filtering is performed. If $filter is not provided, the unfiltered list - includes all policy exemptions associated with the scope, including those - that apply directly or apply from containing scopes. If $filter=atScope() - is provided, the returned list only includes all policy exemptions that - apply to the scope, which is everything in the unfiltered list except - those applied to sub scopes contained within the given scope. If $filter=atExactScope() - is provided, the returned list only includes all policy exemptions that - at the given scope. If $filter=excludeExpired() is provided, the returned - list only includes all policy exemptions that either haven't expired - or didn't set expiration date. If $filter=policyAssignmentId eq '{value}' - is provided. the returned list only includes all policy exemptions that - are associated with the give policyAssignmentId.", name: filter, serializedName: $filter } - nullable: false - operation: *id070 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id027 - - &id082 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id070 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id028 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id052 - - *id076 - - *id077 - - *id078 - - *id079 - - *id080 - - *id081 - - *id082 - - *id083 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions", - uri: "{$host}", - } - signatureParameters: - - *id076 - - *id077 - - *id078 - - *id079 - - *id080 - - *id081 - responses: *id084 - signatureParameters: - - *id076 - - *id077 - - *id078 - - *id079 - - *id080 - - *id081 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - - *id013 -info: { description: "To manage and control access to your resources, you can define - customized policies and assign them at a scope.", title: PolicyClient } -language: - default: { description: "", name: PolicyClient } - java: { description: "", name: PolicyClient } -operationGroups: - - &id086 - $key: DataPolicyManifests - codeModel: *id005 - language: - default: { description: "", name: DataPolicyManifests } - java: { description: "", name: DataPolicyManifests } - operations: - - &id087 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a data policy manifest by policy mode: - parameters: { api-version: "2020-09-01", policyMode: Microsoft.KeyVault.Data } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getDataPolicyManifest.json - responses: - "200": - body: - name: Microsoft.KeyVault.Data - type: Microsoft.Authorization/dataPolicyManifests - id: /providers/Microsoft.Authorization/dataPolicyManifests/Microsoft.KeyVault.Data - properties: - effects: - - { name: Audit } - - { name: Deny } - fieldValues: [type] - isBuiltInOnly: true - namespaces: [Microsoft.KeyVault] - policyMode: Microsoft.KeyVault.Data - resourceFunctions: - custom: - - name: vault - allowCustomProperties: false - defaultProperties: [location, tags] - fullyQualifiedResourceType: Microsoft.KeyVault/vaults - standard: [subscription, resourceGroup] - resourceTypeAliases: - - aliases: - - name: Microsoft.KeyVault.Data/vaults/certificates/keyProperties.keyType - paths: - - path: keyProperties.keyType - apiVersions: ["2019-01-01"] - resourceType: vaults/certificates - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation retrieves the data policy manifest with - the given policy mode., name: GetByPolicyMode, summary: Retrieves a data - policy manifest. } - java: { description: This operation retrieves the data policy manifest with the - given policy mode., name: getByPolicyMode } - operationGroup: *id086 - operationId: DataPolicyManifests_GetByPolicyMode - parameters: - - *id013 - - &id088 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The policy mode of the data policy manifest to get., - name: policyMode, - serializedName: policyMode, - } - java: - { - description: The policy mode of the data policy manifest to get., - name: policyMode, - serializedName: policyMode, - } - nullable: false - operation: *id087 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id102 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - &id089 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id087 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id101 - apiVersions: [] - language: - default: { description: Api Version (2020-09-01), name: ApiVersion20200901 } - protocol: {} - type: CONSTANT - value: { value: "2020-09-01" } - valueType: *id017 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id088 - - *id089 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id087 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Authorization/dataPolicyManifests/{policyMode}", - uri: "{$host}", - } - signatureParameters: - - *id088 - responses: - - language: - default: - { description: OK - Returns information about a data policy manifest., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id099 - apiVersions: - - { version: "2020-09-01" } - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: The data policy manifest., - name: DataPolicyManifest, - namespace: "", - } - java: { description: The data policy manifest., name: DataPolicyManifest } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id016 - immediate: - - *id016 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The data policy manifest properties., name: properties } - java: { description: The data policy manifest properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id371 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: true - language: - default: - { - description: The properties of the data policy manifest., - name: DataPolicyManifestProperties, - namespace: "", - } - java: - { - description: The properties of the data policy manifest., - name: DataPolicyManifestProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The list of namespaces for the data policy - manifest., name: namespaces } - java: - { - description: The list of namespaces for the data policy manifest., - name: namespaces, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id336 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id394 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: "", - name: DataPolicyManifestPropertiesNamespacesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The list of namespaces for the data policy - manifest., name: DataPolicyManifestPropertiesNamespaces } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: namespaces - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The policy mode of the data policy manifest., - name: policyMode, - } - java: - { - description: The policy mode of the data policy manifest., - name: policyMode, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id395 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The policy mode of the data policy manifest., - name: DataPolicyManifestPropertiesPolicyMode, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: policyMode - - apiVersions: [] - isDiscriminator: false - language: - default: { description: A value indicating whether policy mode is allowed - only in built-in definitions., name: isBuiltInOnly } - java: { description: A value indicating whether policy mode is allowed - only in built-in definitions., name: isBuiltInOnly } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id360 - apiVersions: [] - language: - default: { description: A value indicating whether policy mode is - allowed only in built-in definitions., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isBuiltInOnly - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: An array of resource type aliases., - name: resourceTypeAliases, - } - java: - { - description: An array of resource type aliases., - name: resourceTypeAliases, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id340 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id372 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: The resource type aliases definition., - name: ResourceTypeAliases, - namespace: "", - } - java: - { - description: The resource type aliases definition., - name: ResourceTypeAliases, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The resource type name., name: resourceType } - java: { description: The resource type name., name: resourceType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id396 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The resource type name., - name: ResourceTypeAliasesResourceType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resourceType - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The aliases for property names., name: aliases } - java: - { description: The aliases for property names., name: aliases } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id339 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id373 - apiVersions: - - { version: "2020-06-01" } - flattenedSchema: false - language: - default: - { - description: "The alias type. ", - name: Alias, - namespace: "", - } - java: { description: "The alias type. ", name: Alias } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The alias name., name: name } - java: { description: The alias name., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id397 - apiVersions: - - { version: "2020-06-01" } - language: - default: - { description: The alias name., name: AliasName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The paths for an alias., name: paths } - java: - { description: The paths for an alias., name: paths } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id338 - apiVersions: - - { version: "2020-06-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id374 - apiVersions: - - { version: "2020-06-01" } - flattenedSchema: false - language: - default: - { - description: The type of the paths for alias., - name: AliasPath, - namespace: "", - } - java: - { - description: The type of the paths for alias., - name: AliasPath, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The path of an alias., - name: path, - } - java: - { - description: The path of an alias., - name: path, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id398 - apiVersions: - - { version: "2020-06-01" } - language: - default: - { - description: The path of an alias., - name: AliasPath, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: path - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The API versions., - name: apiVersions, - } - java: - { - description: The API versions., - name: apiVersions, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id337 - apiVersions: - - { version: "2020-06-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id399 - apiVersions: - - { version: "2020-06-01" } - language: - default: - { - description: "", - name: AliasPathApiVersionsItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { - description: The API versions., - name: AliasPathApiVersions, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: apiVersions - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The pattern for an alias - path., name: pattern } - java: - { - description: The pattern for an alias path., - name: pattern, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id090 - apiVersions: - - { version: "2020-06-01" } - flattenedSchema: false - language: - default: { description: The type of the pattern - for an alias path., name: AliasPattern, namespace: "" } - java: { description: The type of the pattern for - an alias path., name: AliasPattern } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The alias pattern phrase., - name: phrase, - } - java: - { - description: The alias pattern phrase., - name: phrase, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id400 - apiVersions: - - { version: "2020-06-01" } - language: - default: - { - description: The alias pattern phrase., - name: AliasPatternPhrase, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: phrase - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The alias pattern variable., - name: variable, - } - java: - { - description: The alias pattern variable., - name: variable, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id401 - apiVersions: - - { version: "2020-06-01" } - language: - default: - { - description: The alias pattern variable., - name: AliasPatternVariable, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: variable - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The type of alias pattern, - name: type, - } - java: - { - description: The type of alias pattern, - name: type, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id391 - apiVersions: - - { version: "2020-06-01" } - choiceType: *id017 - choices: - - language: - default: - { description: NotSpecified is not - allowed., name: NOT_SPECIFIED } - value: NotSpecified - - language: - default: - { description: Extract is the only - allowed value., name: EXTRACT } - value: Extract - language: - default: - { - description: The type of alias pattern, - name: AliasPatternType, - } - java: - { - description: The type of alias pattern, - name: AliasPatternType, - } - protocol: {} - type: SEALED_CHOICE - serializedName: type - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: pattern - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The metadata of the alias - path. If missing, fall back to the default metadata - of the alias.", name: metadata } - java: - { description: "The metadata of the alias path. - If missing, fall back to the default metadata - of the alias.", name: metadata } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id091 - apiVersions: - - { version: "2020-06-01" } - flattenedSchema: false - language: - default: - { - description: "", - name: AliasPathMetadata, - namespace: "", - } - java: - { description: "", name: AliasPathMetadata } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The type of the token - that the alias path is referring to., name: type } - java: - { description: The type of the token that - the alias path is referring to., name: type } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id363 - apiVersions: - - { version: "2020-06-01" } - choiceType: *id017 - choices: - - language: - default: - { description: The token type is - not specified., name: NOT_SPECIFIED } - value: NotSpecified - - language: - default: - { description: The token type can - be anything., name: ANY } - value: Any - - language: - default: - { description: The token type is - string., name: STRING } - value: String - - language: - default: - { description: The token type is - object., name: OBJECT } - value: Object - - language: - default: - { description: The token type is - array., name: ARRAY } - value: Array - - language: - default: - { description: The token type is - integer., name: INTEGER } - value: Integer - - language: - default: - { description: The token type is - number., name: NUMBER } - value: Number - - language: - default: - { description: The token type is - boolean., name: BOOLEAN } - value: Boolean - language: - default: - { description: The type of the token - that the alias path is referring to., name: AliasPathTokenType } - java: { description: The type of the token - that the alias path is referring to., name: AliasPathTokenType } - protocol: {} - type: CHOICE - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The attributes of the - token that the alias path is referring to., name: attributes } - java: - { description: The attributes of the token - that the alias path is referring to., name: attributes } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id364 - apiVersions: - - { version: "2020-06-01" } - choiceType: *id017 - choices: - - language: - default: - { description: The token that the - alias path is referring to has no attributes., name: NONE } - value: None - - language: - default: - { description: The token that the - alias path is referring to is modifiable - by policies with 'modify' effect., name: MODIFIABLE } - value: Modifiable - language: - default: - { description: The attributes of the - token that the alias path is referring - to., name: AliasPathAttributes } - java: { description: The attributes of the - token that the alias path is referring - to., name: AliasPathAttributes } - protocol: {} - type: CHOICE - serializedName: attributes - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: metadata - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The paths for an alias., - name: AliasPaths, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: paths - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The type of the alias., name: type } - java: { description: The type of the alias., name: type } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id392 - apiVersions: - - { version: "2020-06-01" } - choiceType: *id017 - choices: - - language: - default: { description: Alias type is unknown (same - as not providing alias type)., name: NOT_SPECIFIED } - value: NotSpecified - - language: - default: - { - description: Alias value is not secret., - name: PLAIN_TEXT, - } - value: PlainText - - language: - default: - { - description: Alias value is secret., - name: MASK, - } - value: Mask - language: - default: - { - description: The type of the alias., - name: AliasType, - } - java: - { - description: The type of the alias., - name: AliasType, - } - protocol: {} - type: SEALED_CHOICE - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The default path for an alias., - name: defaultPath, - } - java: - { - description: The default path for an alias., - name: defaultPath, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id402 - apiVersions: - - { version: "2020-06-01" } - language: - default: - { - description: The default path for an alias., - name: AliasDefaultPath, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: defaultPath - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The default pattern for an alias., - name: defaultPattern, - } - java: - { - description: The default pattern for an alias., - name: defaultPattern, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id090 - serializedName: defaultPattern - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The default alias path metadata. - Applies to the default path and to any alias path - that doesn't have metadata, name: defaultMetadata } - java: - { description: The default alias path metadata. Applies - to the default path and to any alias path that doesn't - have metadata, name: defaultMetadata } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id091 - serializedName: defaultMetadata - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The aliases for property names., - name: ResourceTypeAliases, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: aliases - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: An array of resource type aliases., - name: DataPolicyManifestPropertiesResourceTypeAliases, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: resourceTypeAliases - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The effect definition., name: effects } - java: { description: The effect definition., name: effects } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id341 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id375 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: The data effect definition., - name: DataEffect, - namespace: "", - } - java: { description: The data effect definition., name: DataEffect } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The data effect name., name: name } - java: { description: The data effect name., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id403 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { description: The data effect name., name: DataEffectName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The data effect details schema., - name: detailsSchema, - } - java: - { - description: The data effect details schema., - name: detailsSchema, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: detailsSchema - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The effect definition., - name: DataPolicyManifestPropertiesEffects, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: effects - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The non-alias field accessor values that can - be used in the policy rule., name: fieldValues } - java: { description: The non-alias field accessor values that can be - used in the policy rule., name: fieldValues } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id342 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id404 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: "", - name: DataPolicyManifestPropertiesFieldValuesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The non-alias field accessor values that - can be used in the policy rule., name: DataPolicyManifestPropertiesFieldValues } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: fieldValues - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The resource functions definition specified - in the data manifest., name: resourceFunctions } - java: { description: The resource functions definition specified in - the data manifest., name: resourceFunctions } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id376 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: true - language: - default: - { - description: The resource functions supported by a manifest, - name: DataManifestResourceFunctionsDefinition, - namespace: "", - } - java: - { - description: The resource functions supported by a manifest, - name: DataManifestResourceFunctionsDefinition, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The standard resource functions (subscription - and/or resourceGroup)., name: standard } - java: { description: The standard resource functions (subscription - and/or resourceGroup)., name: standard } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id343 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id405 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: "", - name: DataManifestResourceFunctionsDefinitionStandardItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: The standard resource functions (subscription - and/or resourceGroup)., name: DataManifestResourceFunctionsDefinitionStandard } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: standard - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: An array of data manifest custom resource - definition., name: custom } - java: { description: An array of data manifest custom resource - definition., name: custom } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id345 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id377 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: The custom resource function definition., - name: DataManifestCustomResourceFunctionDefinition, - namespace: "", - } - java: - { - description: The custom resource function definition., - name: DataManifestCustomResourceFunctionDefinition, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The function name as it will appear - in the policy rule. eg - 'vault'., name: name } - java: { description: The function name as it will appear - in the policy rule. eg - 'vault'., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id406 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { description: The function name as it will appear - in the policy rule. eg - 'vault'., name: DataManifestCustomResourceFunctionDefinitionName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The fully qualified control plane - resource type that this function represents. eg - 'Microsoft.KeyVault/vaults'., name: fullyQualifiedResourceType } - java: - { description: The fully qualified control plane resource - type that this function represents. eg - 'Microsoft.KeyVault/vaults'., name: fullyQualifiedResourceType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id407 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The fully qualified control plane - resource type that this function represents. eg - - 'Microsoft.KeyVault/vaults'., name: DataManifestCustomResourceFunctionDefinitionFullyQualifiedResourceType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: fullyQualifiedResourceType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: 'The top-level properties that can - be selected on the function''s output. eg - [ "name", - "location" ] if vault().name and vault().location are - supported', name: defaultProperties } - java: { description: 'The top-level properties that can be - selected on the function''s output. eg - [ "name", "location" - ] if vault().name and vault().location are supported', name: defaultProperties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id344 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id408 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: "", - name: DataManifestCustomResourceFunctionDefinitionDefaultPropertiesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: 'The top-level properties that - can be selected on the function''s output. eg - [ - "name", "location" ] if vault().name and vault().location - are supported', name: DataManifestCustomResourceFunctionDefinitionDefaultProperties } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: defaultProperties - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A value indicating whether the custom - properties within the property bag are allowed. Needs - api-version to be specified in the policy rule eg - - vault('2019-06-01')., name: allowCustomProperties } - java: { description: A value indicating whether the custom - properties within the property bag are allowed. Needs - api-version to be specified in the policy rule eg - - vault('2019-06-01')., name: allowCustomProperties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id361 - apiVersions: [] - language: - default: { description: A value indicating whether the - custom properties within the property bag are allowed. - Needs api-version to be specified in the policy rule - eg - vault('2019-06-01')., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: allowCustomProperties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: An array of data manifest custom resource - definition., name: DataManifestResourceFunctionsDefinitionCustom } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: custom - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: resourceFunctions - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id088 - - &id097 - apiVersions: &id092 - - { version: "2020-09-01" } - exceptions: &id093 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id094 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List data policy manifests: - parameters: { api-version: "2020-09-01" } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listDataPolicyManifests.json - responses: - "200": - body: - value: - - name: Microsoft.KeyVault.Data - type: Microsoft.Authorization/dataPolicyManifests - id: /providers/Microsoft.Authorization/dataPolicyManifests/Microsoft.KeyVault.Data - properties: - effects: - - { name: audit } - - { name: deny } - fieldValues: [type] - isBuiltInOnly: true - namespaces: [Microsoft.KeyVault] - policyMode: Microsoft.KeyVault.Data - resourceFunctions: - custom: - - name: vault - allowCustomProperties: false - defaultProperties: [location, tags] - fullyQualifiedResourceType: Microsoft.KeyVault/vaults - standard: [subscription, resourceGroup] - resourceTypeAliases: - - aliases: - - name: Microsoft.KeyVault.Data/vaults/certificates/keyProperties.keyType - paths: - - path: keyProperties.keyType - apiVersions: ["2019-01-01"] - resourceType: vaults/certificates - - name: Microsoft.Kubernetes.Data - type: Microsoft.Authorization/dataPolicyManifests - id: /providers/Microsoft.Authorization/dataPolicyManifests/Microsoft.Kubernetes.Data - properties: - effects: - - name: audit - detailsSchema: - type: object - additionalProperties: false - properties: - constraint: - { - type: string, - pattern: '^(?i)(https:\/\/raw\.githubusercontent\.com\/){1}(.+)(\.){1}(yaml|yml){1}$', - } - constraintTemplate: - { - type: string, - pattern: '^(?i)(https:\/\/raw\.githubusercontent\.com\/){1}(.+)(\.){1}(yaml|yml){1}$', - } - values: - type: object - additionalProperties: {} - maxProperties: 10 - required: [constraintTemplate] - isBuiltInOnly: false - namespaces: [Microsoft.Kubernetes, Microsoft.ContainerService] - policyMode: Microsoft.Kubernetes.Data - headers: {} - List data policy manifests with namespace filter: - parameters: - { $filter: namespace eq 'Microsoft.KeyVault', api-version: "2020-09-01" } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listDataPolicyManifestsNamespaceFilter.json - responses: - "200": - body: - value: - - name: Microsoft.KeyVault.Data - type: Microsoft.Authorization/dataPolicyManifests - id: /providers/Microsoft.Authorization/dataPolicyManifests/Microsoft.KeyVault.Data - properties: - effects: - - { name: audit } - - { name: deny } - fieldValues: [type] - isBuiltInOnly: true - namespaces: [Microsoft.KeyVault] - policyMode: Microsoft.KeyVault.Data - resourceFunctions: - custom: - - name: vault - allowCustomProperties: false - defaultProperties: [location, tags] - fullyQualifiedResourceType: Microsoft.KeyVault/vaults - standard: [subscription, resourceGroup] - resourceTypeAliases: - - aliases: - - name: Microsoft.KeyVault.Data/vaults/certificates/keyProperties.keyType - paths: - - path: keyProperties.keyType - apiVersions: ["2019-01-01"] - resourceType: vaults/certificates - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id096 - $key: listNext - apiVersions: *id092 - exceptions: *id093 - extensions: *id094 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id086 - parameters: [] - requests: - - language: &id100 - default: { description: 'This operation retrieves a list of all the data - policy manifests that match the optional given $filter. Valid values - for $filter are: "$filter=namespace eq ''{0}''". If $filter is not - provided, the unfiltered list includes all data policy manifests - for data resource types. If $filter=namespace is provided, the returned - list only includes all data policy manifests that have a namespace - matching the provided value.', name: List, summary: Retrieves data - policy manifests } - java: { description: 'This operation retrieves a list of all the data - policy manifests that match the optional given $filter. Valid values - for $filter are: "$filter=namespace eq ''{0}''". If $filter is not - provided, the unfiltered list includes all data policy manifests - for data resource types. If $filter=namespace is provided, the returned - list only includes all data policy manifests that have a namespace - matching the provided value.', name: list } - parameters: - - &id098 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id095 { name: nextLink, serializedName: nextLink } - java: *id095 - nullable: false - operation: *id096 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id105 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id097 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id098 - responses: &id106 - - language: - default: - { description: OK - Returns an array of data policy manifests., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id378 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: List of data policy manifests., - name: DataPolicyManifestListResult, - namespace: "", - } - java: - { - description: List of data policy manifests., - name: DataPolicyManifestListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An array of data policy manifests., name: value } - java: { description: An array of data policy manifests., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id348 - apiVersions: - - { version: "2020-09-01" } - elementType: *id099 - language: - default: - { - description: An array of data policy manifests., - name: DataPolicyManifestListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The URL to use for getting the next set of - results., name: nextLink } - java: - { - description: The URL to use for getting the next set of results., - name: nextLink, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id413 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The URL to use for getting the next set - of results., name: DataPolicyManifestListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id100 - operationGroup: *id086 - operationId: DataPolicyManifests_List - parameters: - - *id013 - - &id103 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id097 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id104 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: 'The filter to apply on the operation. Valid values - for $filter are: "namespace eq ''{value}''". If $filter is not provided, - no filtering is performed. If $filter=namespace eq ''{value}'' is provided, - the returned list only includes all data policy manifests that have a - namespace matching the provided value.', name: filter, serializedName: $filter } - java: { description: 'The filter to apply on the operation. Valid values for - $filter are: "namespace eq ''{value}''". If $filter is not provided, no - filtering is performed. If $filter=namespace eq ''{value}'' is provided, - the returned list only includes all data policy manifests that have a - namespace matching the provided value.', name: filter, serializedName: $filter } - nullable: false - operation: *id097 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id103 - - *id104 - - *id105 - protocol: - http: - { - explode: false, - method: get, - path: /providers/Microsoft.Authorization/dataPolicyManifests, - uri: "{$host}", - } - signatureParameters: - - *id104 - responses: *id106 - signatureParameters: - - *id104 - - *id096 - protocol: {} - - &id107 - $key: PolicyAssignments - codeModel: *id005 - language: - default: { description: "", name: PolicyAssignments } - java: { description: "", name: PolicyAssignments } - operations: - - &id108 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete a policy assignment: - parameters: - { - api-version: "2020-09-01", - policyAssignmentName: EnforceNaming, - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/deletePolicyAssignment.json - responses: - "200": - body: - name: EnforceNaming - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - metadata: { assignedBy: Special Someone } - notScopes: [] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - "204": - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "This operation deletes a policy assignment, given its - name and the scope it was created in. The scope of a policy assignment is - the part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: Delete, summary: Deletes a policy assignment. } - java: { description: "This operation deletes a policy assignment, given its name - and the scope it was created in. The scope of a policy assignment is the - part of its ID preceding '/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: delete } - operationGroup: *id107 - operationId: PolicyAssignments_Delete - parameters: - - *id013 - - &id109 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The scope of the policy assignment. Valid scopes are: - management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - java: { description: "The scope of the policy assignment. Valid scopes are: - management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - nullable: false - operation: *id108 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id110 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy assignment to delete., - name: policyAssignmentName, - serializedName: policyAssignmentName, - } - java: - { - description: The name of the policy assignment to delete., - name: policyAssignmentName, - serializedName: policyAssignmentName, - } - nullable: false - operation: *id108 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id111 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id108 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id109 - - *id110 - - *id111 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id108 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: delete, - path: "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", - uri: "{$host}", - } - signatureParameters: - - *id109 - - *id110 - responses: - - language: - default: - { description: OK - Returns information about the deleted assignment., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id116 - apiVersions: - - { version: "2020-09-01" } - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { description: The policy assignment., name: PolicyAssignment, namespace: "" } - java: { description: The policy assignment., name: PolicyAssignment } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id016 - immediate: - - *id016 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Properties for the policy assignment., name: properties } - java: { description: Properties for the policy assignment., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id379 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: true - language: - default: - { - description: The policy assignment properties., - name: PolicyAssignmentProperties, - namespace: "", - } - java: - { - description: The policy assignment properties., - name: PolicyAssignmentProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The display name of the policy assignment., - name: displayName, - } - java: - { - description: The display name of the policy assignment., - name: displayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id414 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The display name of the policy assignment., - name: PolicyAssignmentPropertiesDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The ID of the policy definition or policy set - definition being assigned., name: policyDefinitionId } - java: { description: The ID of the policy definition or policy set - definition being assigned., name: policyDefinitionId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id415 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The ID of the policy definition or policy - set definition being assigned., name: PolicyAssignmentPropertiesPolicyDefinitionId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: policyDefinitionId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The scope for the policy assignment., name: scope } - java: { description: The scope for the policy assignment., name: scope } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id416 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The scope for the policy assignment., - name: PolicyAssignmentPropertiesScope, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: scope - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy's excluded scopes., name: notScopes } - java: { description: The policy's excluded scopes., name: notScopes } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id349 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id417 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { description: "", name: PolicyAssignmentPropertiesNotScopesItem } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { - description: The policy's excluded scopes., - name: PolicyAssignmentPropertiesNotScopes, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: notScopes - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The parameter values for the assigned policy - rule. The keys are the parameter names., name: parameters } - java: { description: The parameter values for the assigned policy rule. - The keys are the parameter names., name: parameters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id270 - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id380 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: The value of a parameter., - name: ParameterValuesValue, - namespace: "", - } - java: - { - description: The value of a parameter., - name: ParameterValuesValue, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The value of the parameter., name: value } - java: { description: The value of the parameter., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: { description: The parameter values for the policy rule. - The keys are the parameter names., name: ParameterValues } - java: { description: The parameter values for the policy rule. The - keys are the parameter names., name: ParameterValues } - protocol: {} - type: DICTIONARY - serializedName: parameters - - apiVersions: [] - isDiscriminator: false - language: - default: { description: This message will be part of response in case - of policy violation., name: description } - java: { description: This message will be part of response in case - of policy violation., name: description } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id418 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: This message will be part of response in - case of policy violation., name: PolicyAssignmentPropertiesDescription } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy assignment metadata. Metadata is - an open ended object and is typically a collection of key value - pairs., name: metadata } - java: { description: The policy assignment metadata. Metadata is an - open ended object and is typically a collection of key value pairs., name: metadata } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: metadata - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy assignment enforcement mode. Possible - values are Default and DoNotEnforce., name: enforcementMode } - java: { description: The policy assignment enforcement mode. Possible - values are Default and DoNotEnforce., name: enforcementMode } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id365 - apiVersions: - - { version: "2020-09-01" } - choiceType: *id017 - choices: - - language: - default: - { description: The policy effect is enforced during resource - creation or update., name: DEFAULT } - value: Default - - language: - default: { description: The policy effect is not enforced during - resource creation or update., name: DO_NOT_ENFORCE } - value: DoNotEnforce - defaultValue: Default - language: - default: { description: The policy assignment enforcement mode. Possible - values are Default and DoNotEnforce., name: EnforcementMode } - java: { description: The policy assignment enforcement mode. Possible - values are Default and DoNotEnforce., name: EnforcementMode } - protocol: {} - type: CHOICE - serializedName: enforcementMode - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The messages that describe why a resource is - non-compliant with the policy., name: nonComplianceMessages } - java: - { - description: - The messages that describe why a resource is non-compliant - with the policy., - name: nonComplianceMessages, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id350 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id381 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: { description: A message that describes why a resource - is non-compliant with the policy. This is shown in 'deny' - error messages and on resource's non-compliant compliance - results., name: NonComplianceMessage, namespace: "" } - java: { description: A message that describes why a resource is - non-compliant with the policy. This is shown in 'deny' error - messages and on resource's non-compliant compliance results., name: NonComplianceMessage } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: A message that describes why a resource - is non-compliant with the policy. This is shown in 'deny' - error messages and on resource's non-compliant compliance - results., name: message } - java: { description: A message that describes why a resource - is non-compliant with the policy. This is shown in 'deny' - error messages and on resource's non-compliant compliance - results., name: message } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id419 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: A message that describes why a resource - is non-compliant with the policy. This is shown in 'deny' - error messages and on resource's non-compliant compliance - results., name: NonComplianceMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy definition reference ID within - a policy set definition the message is intended for. This - is only applicable if the policy assignment assigns a policy - set definition. If this is not provided the message applies - to all policies assigned by this policy assignment., name: policyDefinitionReferenceId } - java: { description: The policy definition reference ID within - a policy set definition the message is intended for. This - is only applicable if the policy assignment assigns a policy - set definition. If this is not provided the message applies - to all policies assigned by this policy assignment., name: policyDefinitionReferenceId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id420 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The policy definition reference ID - within a policy set definition the message is intended - for. This is only applicable if the policy assignment - assigns a policy set definition. If this is not provided - the message applies to all policies assigned by this policy - assignment., name: NonComplianceMessagePolicyDefinitionReferenceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: policyDefinitionReferenceId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: { description: The messages that describe why a resource - is non-compliant with the policy., name: PolicyAssignmentPropertiesNonComplianceMessages } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: nonComplianceMessages - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The location of the policy assignment. Only required - when utilizing managed identity., name: location } - java: { description: The location of the policy assignment. Only required - when utilizing managed identity., name: location } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id421 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The location of the policy assignment. Only required - when utilizing managed identity., name: PolicyAssignmentLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: location - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The managed identity associated with the policy - assignment., name: identity } - java: - { - description: The managed identity associated with the policy assignment., - name: identity, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id382 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { description: Identity for the resource., name: Identity, namespace: "" } - java: { description: Identity for the resource., name: Identity } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The principal ID of the resource identity., - name: principalId, - } - java: - { - description: The principal ID of the resource identity., - name: principalId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id422 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The principal ID of the resource identity., - name: IdentityPrincipalId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: principalId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The tenant ID of the resource identity., name: tenantId } - java: - { description: The tenant ID of the resource identity., name: tenantId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id423 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The tenant ID of the resource identity., - name: IdentityTenantId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: tenantId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The identity type. This is the only required - field when adding a system assigned identity to a resource., name: type } - java: { description: The identity type. This is the only required field - when adding a system assigned identity to a resource., name: type } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id393 - apiVersions: - - { version: "2020-09-01" } - choiceType: *id017 - choices: - - language: - default: { description: Indicates that a system assigned identity - is associated with the resource., name: SYSTEM_ASSIGNED } - value: SystemAssigned - - language: - default: { description: Indicates that no identity is associated - with the resource or that the existing identity should be - removed., name: NONE } - value: None - language: - default: { description: The identity type. This is the only required - field when adding a system assigned identity to a resource., name: ResourceIdentityType } - java: { description: The identity type. This is the only required - field when adding a system assigned identity to a resource., name: ResourceIdentityType } - protocol: {} - type: SEALED_CHOICE - serializedName: type - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: identity - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - language: - default: { description: No Content - the policy assignment doesn't exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id109 - - *id110 - - &id112 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create or update a policy assignment: - parameters: - api-version: "2020-09-01" - parameters: - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - metadata: { assignedBy: Special Someone } - nonComplianceMessages: - - { message: Resource names must start with 'DeptA' and end with - '-LC'. } - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyAssignmentName: EnforceNaming - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createPolicyAssignment.json - responses: - "201": - body: - name: EnforceNaming - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - enforcementMode: Default - metadata: { assignedBy: Special Someone } - nonComplianceMessages: - - { message: Resource names must start with 'DeptA' and end with - '-LC'. } - notScopes: [] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - Create or update a policy assignment with multiple non-compliance messages: - parameters: - api-version: "2020-09-01" - parameters: - properties: - displayName: Enforce security policies - nonComplianceMessages: - - { message: Resources must comply with all internal security policies. - See for more info. } - - { message: Resource names must start with 'DeptA' and end with - '-LC'., policyDefinitionReferenceId: "10420126870854049575" } - - { - message: Storage accounts must have firewall rules configured., - policyDefinitionReferenceId: "8572513655450389710", - } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/securityInitiative - policyAssignmentName: securityInitAssignment - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createPolicyAssignmentNonComplianceMessages.json - responses: - "201": - body: - name: securityInitAssignment - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/securityInitAssignment - properties: - displayName: Enforce security policies - enforcementMode: Default - metadata: { assignedBy: User 1 } - nonComplianceMessages: - - { message: Resources must comply with all internal security policies. - See for more info. } - - { message: Resource names must start with 'DeptA' and end with - '-LC'., policyDefinitionReferenceId: "10420126870854049575" } - - { - message: Storage accounts must have firewall rules configured., - policyDefinitionReferenceId: "8572513655450389710", - } - notScopes: [] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/securityInitiative - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - Create or update a policy assignment without enforcing policy effect during resource creation or update.: - parameters: - api-version: "2020-09-01" - parameters: - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - enforcementMode: DoNotEnforce - metadata: { assignedBy: Special Someone } - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyAssignmentName: EnforceNaming - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createPolicyAssignmentWithoutEnforcement.json - responses: - "201": - body: - name: EnforceNaming - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - enforcementMode: DoNotEnforce - metadata: { assignedBy: Special Someone } - notScopes: [] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - Create or update a policy assignment with a managed identity: - parameters: - api-version: "2020-09-01" - parameters: - identity: { type: SystemAssigned } - location: eastus - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - enforcementMode: Default - metadata: { assignedBy: Foo Bar } - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyAssignmentName: EnforceNaming - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createPolicyAssignmentWithIdentity.json - responses: - "201": - body: - name: EnforceNaming - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: eastus - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - enforcementMode: Default - metadata: { assignedBy: Special Someone } - notScopes: [] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: " This operation creates or updates a policy assignment - with the given scope and name. Policy assignments apply to all resources - contained within their scope. For example, when you assign a policy at resource - group scope, that policy applies to all resources in the group.", name: Create, summary: Creates or updates a policy assignment. } - java: { description: " This operation creates or updates a policy assignment - with the given scope and name. Policy assignments apply to all resources - contained within their scope. For example, when you assign a policy at resource - group scope, that policy applies to all resources in the group.", name: create } - operationGroup: *id107 - operationId: PolicyAssignments_Create - parameters: - - *id013 - - &id113 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The scope of the policy assignment. Valid scopes are: - management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - java: { description: "The scope of the policy assignment. Valid scopes are: - management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - nullable: false - operation: *id112 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id114 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy assignment., - name: policyAssignmentName, - serializedName: policyAssignmentName, - } - java: - { - description: The name of the policy assignment., - name: policyAssignmentName, - serializedName: policyAssignmentName, - } - nullable: false - operation: *id112 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id115 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id112 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id113 - - *id114 - - *id115 - - &id117 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Parameters for the policy assignment., name: parameters } - java: { description: Parameters for the policy assignment., name: parameters } - nullable: false - operation: *id112 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id116 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id112 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName} - uri: "{$host}" - signatureParameters: - - *id113 - - *id114 - - *id117 - responses: - - language: - default: { description: Created - Returns information about the new policy - assignment., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id116 - signatureParameters: - - *id113 - - *id114 - - &id118 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a policy assignment with a managed identity: - parameters: - { - api-version: "2020-09-01", - policyAssignmentName: EnforceNaming, - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicyAssignmentWithIdentity.json - responses: - "200": - body: - name: EnforceNaming - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: westus - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - enforcementMode: Default - metadata: { assignedBy: Special Someone } - notScopes: [] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - Retrieve a policy assignment: - parameters: - { - api-version: "2020-09-01", - policyAssignmentName: EnforceNaming, - scope: subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicyAssignment.json - responses: - "200": - body: - name: EnforceNaming - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/EnforceNaming - properties: - description: Force resource names to begin with given DeptA and - end with -LC - displayName: Enforce resource naming rules - enforcementMode: Default - metadata: { assignedBy: Special Someone } - notScopes: [] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "This operation retrieves a single policy assignment, - given its name and the scope it was created at.", name: Get, summary: Retrieves - a policy assignment. } - java: { description: "This operation retrieves a single policy assignment, given - its name and the scope it was created at.", name: get } - operationGroup: *id107 - operationId: PolicyAssignments_Get - parameters: - - *id013 - - &id119 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The scope of the policy assignment. Valid scopes are: - management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - java: { description: "The scope of the policy assignment. Valid scopes are: - management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'", name: scope, serializedName: scope } - nullable: false - operation: *id118 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id120 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy assignment to get., - name: policyAssignmentName, - serializedName: policyAssignmentName, - } - java: - { - description: The name of the policy assignment to get., - name: policyAssignmentName, - serializedName: policyAssignmentName, - } - nullable: false - operation: *id118 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id121 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id118 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id119 - - *id120 - - *id121 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id118 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}", - uri: "{$host}", - } - signatureParameters: - - *id119 - - *id120 - responses: - - language: - default: - { description: OK - Returns information about the policy assignment., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id116 - signatureParameters: - - *id119 - - *id120 - - &id127 - apiVersions: &id122 - - { version: "2020-09-01" } - exceptions: &id123 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id124 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy assignments that apply to a resource group: - parameters: - { - $filter: atScope(), - api-version: "2020-09-01", - resourceGroupName: TestResourceGroup, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicyAssignmentsForResourceGroup.json - responses: - "200": - body: - value: - - name: TestCostManagement - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestCostManagement - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: eastus - properties: - description: Minimize the risk of accidental cost overruns - displayName: Storage Cost Management - metadata: { category: Cost Management } - notScopes: [] - parameters: - allowedSkus: { value: Standard_A1 } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/storageSkus - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup - - name: TestTagEnforcement - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestTagEnforcement - properties: - description: Ensure a given tag key and value are present on - all resources - displayName: Enforces a tag key and value - notScopes: [] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id126 - $key: listForResourceGroupNext - apiVersions: *id122 - exceptions: *id123 - extensions: *id124 - language: - java: { description: Get the next page of items, name: listForResourceGroupNext } - operationGroup: *id107 - parameters: [] - requests: - - language: &id129 - default: { description: "This operation retrieves the list of all policy - assignments associated with the given resource group in the given - subscription that match the optional given $filter. Valid values - for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, the unfiltered list - includes all policy assignments associated with the resource group, - including those that apply directly or apply from containing scopes, - as well as any applied to resources contained within the resource - group. If $filter=atScope() is provided, the returned list includes - all policy assignments that apply to the resource group, which is - everything in the unfiltered list except those applied to resources - contained within the resource group. If $filter=atExactScope() is - provided, the returned list only includes all policy assignments - that at the resource group. If $filter=policyDefinitionId eq '{value}' - is provided, the returned list includes all policy assignments of - the policy definition whose id is {value} that apply to the resource - group.", name: ListForResourceGroup, summary: Retrieves all policy - assignments that apply to a resource group. } - java: { description: "This operation retrieves the list of all policy - assignments associated with the given resource group in the given - subscription that match the optional given $filter. Valid values - for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, the unfiltered list - includes all policy assignments associated with the resource group, - including those that apply directly or apply from containing scopes, - as well as any applied to resources contained within the resource - group. If $filter=atScope() is provided, the returned list includes - all policy assignments that apply to the resource group, which is - everything in the unfiltered list except those applied to resources - contained within the resource group. If $filter=atExactScope() is - provided, the returned list only includes all policy assignments - that at the resource group. If $filter=policyDefinitionId eq '{value}' - is provided, the returned list includes all policy assignments of - the policy definition whose id is {value} that apply to the resource - group.", name: listByResourceGroup } - parameters: - - &id128 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id125 { name: nextLink, serializedName: nextLink } - java: *id125 - nullable: false - operation: *id126 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id134 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id127 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id128 - responses: &id135 - - language: - default: { description: OK - Returns an array of policy assignments., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id143 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: List of policy assignments., - name: PolicyAssignmentListResult, - namespace: "", - } - java: - { - description: List of policy assignments., - name: PolicyAssignmentListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An array of policy assignments., name: value } - java: { description: An array of policy assignments., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id351 - apiVersions: - - { version: "2020-09-01" } - elementType: *id116 - language: - default: - { - description: An array of policy assignments., - name: PolicyAssignmentListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The URL to use for getting the next set of - results., name: nextLink } - java: - { - description: The URL to use for getting the next set of results., - name: nextLink, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id424 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The URL to use for getting the next set - of results., name: PolicyAssignmentListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id129 - operationGroup: *id107 - operationId: PolicyAssignments_ListForResourceGroup - parameters: - - *id013 - - &id130 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains policy - assignments., name: resourceGroupName, serializedName: resourceGroupName } - java: - { - description: The name of the resource group that contains policy assignments., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id127 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id145 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: "", name: String } - maxLength: 90.0 - minLength: 1.0 - pattern: ^[-\w\._\(\)]+$ - protocol: {} - type: STRING - - &id131 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id127 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id132 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id127 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id146 - apiVersions: - - { version: "2020-09-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: "", name: Integer } - maximum: 1000.0 - minimum: 1.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - - &id133 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id127 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id130 - - *id131 - - *id132 - - *id133 - - *id052 - - *id134 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - uri: "{$host}", - } - signatureParameters: - - *id130 - - *id131 - - *id132 - responses: *id135 - signatureParameters: - - *id130 - - *id131 - - *id132 - - &id141 - apiVersions: &id136 - - { version: "2020-09-01" } - exceptions: &id137 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id138 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List all policy assignments that apply to a resource: - parameters: - { - api-version: "2020-09-01", - parentResourcePath: virtualMachines/MyTestVm, - resourceGroupName: TestResourceGroup, - resourceName: MyTestComputer.cloudapp.net, - resourceProviderNamespace: Microsoft.Compute, - resourceType: domainNames, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicyAssignmentsForResource.json - responses: - "200": - body: - value: - - name: TestCostManagement - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestCostManagement - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: eastus - properties: - description: Minimize the risk of accidental cost overruns - displayName: VM Cost Management - metadata: { category: Cost Management } - notScopes: [] - parameters: - allowedSkus: { value: Standard_A1 } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/vmSkus - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup - - name: TestTagEnforcement - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup/providers/Microsoft.Authorization/policyAssignments/TestTagEnforcement - properties: - description: Ensure a given tag key and value are present on - all resources - displayName: Enforces a tag key and value - notScopes: [] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/resourceGroups/TestResourceGroup - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id140 - $key: listForResourceNext - apiVersions: *id136 - exceptions: *id137 - extensions: *id138 - language: - java: { description: Get the next page of items, name: listForResourceNext } - operationGroup: *id107 - parameters: [] - requests: - - language: &id144 - default: { description: "This operation retrieves the list of all policy - assignments associated with the specified resource in the given - resource group and subscription that match the optional given $filter. - Valid values for $filter are: 'atScope()', 'atExactScope()' - or 'policyDefinitionId eq '{value}''. If $filter is not provided, - the unfiltered list includes all policy assignments associated with - the resource, including those that apply directly or from all containing - scopes, as well as any applied to resources contained within the - resource. If $filter=atScope() is provided, the returned list includes - all policy assignments that apply to the resource, which is everything - in the unfiltered list except those applied to resources contained - within the resource. If $filter=atExactScope() is provided, the - returned list only includes all policy assignments that at the resource - level. If $filter=policyDefinitionId eq '{value}' is provided, - the returned list includes all policy assignments of the policy - definition whose id is {value} that apply to the resource. Three - parameters plus the resource name are used to identify a specific - resource. If the resource is not part of a parent resource (the - more common case), the parent resource path should not be provided - (or provided as ''). For example a web app could be specified - as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} - == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). - If the resource is part of a parent resource, then all parameters - should be provided. For example a virtual machine DNS name could - be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', - {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} - == 'domainNames', {resourceName} == 'MyComputerName'). A convenient - alternative to providing the namespace and type name separately - is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} - == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', - {resourceName} == 'MyWebApp').", name: ListForResource, summary: Retrieves - all policy assignments that apply to a resource. } - java: { description: "This operation retrieves the list of all policy - assignments associated with the specified resource in the given - resource group and subscription that match the optional given $filter. - Valid values for $filter are: 'atScope()', 'atExactScope()' - or 'policyDefinitionId eq '{value}''. If $filter is not provided, - the unfiltered list includes all policy assignments associated with - the resource, including those that apply directly or from all containing - scopes, as well as any applied to resources contained within the - resource. If $filter=atScope() is provided, the returned list includes - all policy assignments that apply to the resource, which is everything - in the unfiltered list except those applied to resources contained - within the resource. If $filter=atExactScope() is provided, the - returned list only includes all policy assignments that at the resource - level. If $filter=policyDefinitionId eq '{value}' is provided, - the returned list includes all policy assignments of the policy - definition whose id is {value} that apply to the resource. Three - parameters plus the resource name are used to identify a specific - resource. If the resource is not part of a parent resource (the - more common case), the parent resource path should not be provided - (or provided as ''). For example a web app could be specified - as ({resourceProviderNamespace} == 'Microsoft.Web', {parentResourcePath} - == '', {resourceType} == 'sites', {resourceName} == 'MyWebApp'). - If the resource is part of a parent resource, then all parameters - should be provided. For example a virtual machine DNS name could - be specified as ({resourceProviderNamespace} == 'Microsoft.Compute', - {parentResourcePath} == 'virtualMachines/MyVirtualMachine', {resourceType} - == 'domainNames', {resourceName} == 'MyComputerName'). A convenient - alternative to providing the namespace and type name separately - is to provide both in the {resourceType} parameter, format: ({resourceProviderNamespace} - == '', {parentResourcePath} == '', {resourceType} == 'Microsoft.Web/sites', - {resourceName} == 'MyWebApp').", name: listForResource } - parameters: - - &id142 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id139 { name: nextLink, serializedName: nextLink } - java: *id139 - nullable: false - operation: *id140 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id155 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id141 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id142 - responses: &id156 - - language: - default: { description: OK - Returns an array of policy assignments., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id143 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id144 - operationGroup: *id107 - operationId: PolicyAssignments_ListForResource - parameters: - - *id013 - - &id147 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource group containing the resource., - name: resourceGroupName, - serializedName: resourceGroupName, - } - java: - { - description: The name of the resource group containing the resource., - name: resourceGroupName, - serializedName: resourceGroupName, - } - nullable: false - operation: *id141 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id145 - - &id148 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The namespace of the resource provider. For example, - the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines)", name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - java: { description: "The namespace of the resource provider. For example, - the namespace of a virtual machine is Microsoft.Compute (from Microsoft.Compute/virtualMachines)", name: resourceProviderNamespace, serializedName: resourceProviderNamespace } - nullable: false - operation: *id141 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id149 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: The parent resource path. Use empty string if there - is none., name: parentResourcePath, serializedName: parentResourcePath } - java: { description: The parent resource path. Use empty string if there is - none., name: parentResourcePath, serializedName: parentResourcePath } - nullable: false - operation: *id141 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id150 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: The resource type name. For example the type name of - a web app is 'sites' (from Microsoft.Web/sites)., name: resourceType, serializedName: resourceType } - java: { description: The resource type name. For example the type name of a - web app is 'sites' (from Microsoft.Web/sites)., name: resourceType, serializedName: resourceType } - nullable: false - operation: *id141 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id151 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id141 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id152 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id141 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id153 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id141 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - - &id154 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id141 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id147 - - *id148 - - *id149 - - *id150 - - *id151 - - *id152 - - *id153 - - *id154 - - *id052 - - *id155 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - uri: "{$host}", - } - signatureParameters: - - *id147 - - *id148 - - *id149 - - *id150 - - *id151 - - *id152 - - *id153 - responses: *id156 - signatureParameters: - - *id147 - - *id148 - - *id149 - - *id150 - - *id151 - - *id152 - - *id153 - - &id162 - apiVersions: &id157 - - { version: "2020-09-01" } - exceptions: &id158 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id159 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy assignments that apply to a management group: - parameters: - { - $filter: atScope(), - api-version: "2020-09-01", - managementGroupId: TestManagementGroup, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicyAssignmentsForManagementGroup.json - responses: - "200": - body: - value: - - name: TestCostManagement - type: Microsoft.Authorization/policyAssignments - id: /providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyAssignments/TestCostManagement - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: eastus - properties: - description: Minimize the risk of accidental cost overruns - displayName: Storage Cost Management - metadata: { category: Cost Management } - notScopes: [] - parameters: - allowedSkus: { value: Standard_A1 } - policyDefinitionId: /providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyDefinitions/storageSkus - scope: /providers/Microsoft.Management/managementGroups/TestManagementGroup - - name: TestTagEnforcement - type: Microsoft.Authorization/policyAssignments - id: /providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyAssignments/TestTagEnforcement - properties: - description: Ensure a given tag key and value are present on - all resources - displayName: Enforces a tag key and value - notScopes: [] - policyDefinitionId: /providers/Microsoft.Management/managementGroups/TestManagementGroup/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue - scope: /providers/Microsoft.Management/managementGroups/TestManagementGroup - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id161 - $key: listForManagementGroupNext - apiVersions: *id157 - exceptions: *id158 - extensions: *id159 - language: - java: { description: Get the next page of items, name: listForManagementGroupNext } - operationGroup: *id107 - parameters: [] - requests: - - language: &id164 - default: { description: "This operation retrieves the list of all policy - assignments applicable to the management group that match the given - $filter. Valid values for $filter are: 'atScope()', 'atExactScope()' - or 'policyDefinitionId eq '{value}''. If $filter=atScope() is - provided, the returned list includes all policy assignments that - are assigned to the management group or the management group's - ancestors. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the management group. - If $filter=policyDefinitionId eq '{value}' is provided, the returned - list includes all policy assignments of the policy definition whose - id is {value} that apply to the management group.", name: ListForManagementGroup, summary: Retrieves all policy assignments that apply to a management - group. } - java: { description: "This operation retrieves the list of all policy - assignments applicable to the management group that match the given - $filter. Valid values for $filter are: 'atScope()', 'atExactScope()' - or 'policyDefinitionId eq '{value}''. If $filter=atScope() is - provided, the returned list includes all policy assignments that - are assigned to the management group or the management group's - ancestors. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the management group. - If $filter=policyDefinitionId eq '{value}' is provided, the returned - list includes all policy assignments of the policy definition whose - id is {value} that apply to the management group.", name: listForManagementGroup } - parameters: - - &id163 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id160 { name: nextLink, serializedName: nextLink } - java: *id160 - nullable: false - operation: *id161 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id169 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id162 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id163 - responses: &id170 - - language: - default: { description: OK - Returns an array of policy assignments., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id143 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id164 - operationGroup: *id107 - operationId: PolicyAssignments_ListForManagementGroup - parameters: - - *id013 - - &id165 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id162 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - - &id166 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id162 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id167 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id162 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - - &id168 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id162 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id165 - - *id166 - - *id167 - - *id168 - - *id169 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments", - uri: "{$host}", - } - signatureParameters: - - *id165 - - *id166 - - *id167 - responses: *id170 - signatureParameters: - - *id165 - - *id166 - - *id167 - - &id176 - apiVersions: &id171 - - { version: "2020-09-01" } - exceptions: &id172 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id173 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy assignments that apply to a subscription: - parameters: - { - $filter: atScope(), - api-version: "2020-09-01", - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicyAssignments.json - responses: - "200": - body: - value: - - name: CostManagement - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/CostManagement - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: eastus - properties: - description: Minimize the risk of accidental cost overruns - displayName: Storage Cost Management - metadata: { category: Cost Management } - notScopes: [] - parameters: - allowedSkus: { value: Standard_A1 } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/storageSkus - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - - name: TagEnforcement - type: Microsoft.Authorization/policyAssignments - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyAssignments/TagEnforcement - properties: - description: Ensure a given tag key and value are present on - all resources - displayName: Enforces a tag key and value - notScopes: [] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/TagKeyValue - scope: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id175 - $key: listNext - apiVersions: *id171 - exceptions: *id172 - extensions: *id173 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id107 - parameters: [] - requests: - - language: &id178 - default: { description: "This operation retrieves the list of all policy - assignments associated with the given subscription that match the - optional given $filter. Valid values for $filter are: 'atScope()', - 'atExactScope()' or 'policyDefinitionId eq '{value}''. If - $filter is not provided, the unfiltered list includes all policy - assignments associated with the subscription, including those that - apply directly or from management groups that contain the given - subscription, as well as any applied to objects contained within - the subscription. If $filter=atScope() is provided, the returned - list includes all policy assignments that apply to the subscription, - which is everything in the unfiltered list except those applied - to objects contained within the subscription. If $filter=atExactScope() - is provided, the returned list only includes all policy assignments - that at the subscription. If $filter=policyDefinitionId eq '{value}' - is provided, the returned list includes all policy assignments of - the policy definition whose id is {value}.", name: List, summary: Retrieves - all policy assignments that apply to a subscription. } - java: { description: "This operation retrieves the list of all policy - assignments associated with the given subscription that match the - optional given $filter. Valid values for $filter are: 'atScope()', - 'atExactScope()' or 'policyDefinitionId eq '{value}''. If - $filter is not provided, the unfiltered list includes all policy - assignments associated with the subscription, including those that - apply directly or from management groups that contain the given - subscription, as well as any applied to objects contained within - the subscription. If $filter=atScope() is provided, the returned - list includes all policy assignments that apply to the subscription, - which is everything in the unfiltered list except those applied - to objects contained within the subscription. If $filter=atExactScope() - is provided, the returned list only includes all policy assignments - that at the subscription. If $filter=policyDefinitionId eq '{value}' - is provided, the returned list includes all policy assignments of - the policy definition whose id is {value}.", name: list } - parameters: - - &id177 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id174 { name: nextLink, serializedName: nextLink } - java: *id174 - nullable: false - operation: *id175 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id182 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id176 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id177 - responses: &id183 - - language: - default: { description: OK - Returns an array of policy assignments., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id143 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id178 - operationGroup: *id107 - operationId: PolicyAssignments_List - parameters: - - *id013 - - &id179 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atScope()', 'atExactScope()' or 'policyDefinitionId - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atScope() is provided, the returned list only includes all - policy assignments that apply to the scope, which is everything in the - unfiltered list except those applied to sub scopes contained within the - given scope. If $filter=atExactScope() is provided, the returned list - only includes all policy assignments that at the given scope. If $filter=policyDefinitionId - eq '{value}' is provided, the returned list includes all policy assignments - of the policy definition whose id is {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id176 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id180 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id176 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - - &id181 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id176 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id179 - - *id180 - - *id181 - - *id052 - - *id182 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments", - uri: "{$host}", - } - signatureParameters: - - *id179 - - *id180 - responses: *id183 - signatureParameters: - - *id179 - - *id180 - - &id184 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete a policy assignment by ID: - parameters: - { - api-version: "2020-09-01", - policyAssignmentId: providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/deletePolicyAssignmentById.json - responses: - "200": - body: - name: LowCostStorage - type: Microsoft.Authorization/policyAssignments - id: /providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage - properties: - description: Allow only storage accounts of SKU Standard_GRS or - Standard_LRS to be created - displayName: Enforce storage account SKU - metadata: { assignedBy: Cheapskate Boss } - notScopes: [] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - headers: {} - "204": - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "This operation deletes the policy with the given ID. - Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' - (management group), '/subscriptions/{subscriptionId}' (subscription), - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource - group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - (resource).", name: DeleteById, summary: Deletes a policy assignment. } - java: { description: "This operation deletes the policy with the given ID. Policy - assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - Valid formats for {scope} are: '/providers/Microsoft.Management/managementGroups/{managementGroup}' - (management group), '/subscriptions/{subscriptionId}' (subscription), - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}' (resource - group), or '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}' - (resource).", name: deleteById } - operationGroup: *id107 - operationId: PolicyAssignments_DeleteById - parameters: - - *id013 - - &id185 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The ID of the policy assignment to delete. Use the - format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: policyAssignmentId, serializedName: policyAssignmentId } - java: { description: "The ID of the policy assignment to delete. Use the format - '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: policyAssignmentId, serializedName: policyAssignmentId } - nullable: false - operation: *id184 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id186 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id184 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id185 - - *id186 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id184 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { explode: false, method: delete, path: "/{policyAssignmentId}", uri: "{$host}" } - signatureParameters: - - *id185 - responses: - - language: - default: - { description: OK - Returns information about the policy assignment., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id116 - - language: - default: { description: No Content - the policy assignment doesn't exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id185 - - &id187 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create or update policy assignment by ID: - parameters: - api-version: "2020-09-01" - parameters: - properties: - description: Allow only storage accounts of SKU Standard_GRS or - Standard_LRS to be created - displayName: Enforce storage account SKU - enforcementMode: Default - metadata: { assignedBy: Cheapskate Boss } - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyAssignmentId: providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createPolicyAssignmentById.json - responses: - "201": - body: - name: LowCostStorage - type: Microsoft.Authorization/policyAssignments - id: /providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage - properties: - description: Allow only storage accounts of SKU Standard_GRS or - Standard_LRS to be created - displayName: Enforce storage account SKU - enforcementMode: Default - metadata: { assignedBy: Cheapskate Boss } - notScopes: [] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - headers: {} - Create or update policy assignment with a managed identity by ID: - parameters: - api-version: "2020-09-01" - parameters: - identity: { type: SystemAssigned } - location: eastus - properties: - description: Allow only storage accounts of SKU Standard_GRS or - Standard_LRS to be created - displayName: Enforce storage account SKU - enforcementMode: Default - metadata: { assignedBy: Cheapskate Boss } - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyAssignmentId: providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createPolicyAssignmentWithIdentityById.json - responses: - "201": - body: - name: LowCostStorage - type: Microsoft.Authorization/policyAssignments - id: /providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: eastus - properties: - description: Allow only storage accounts of SKU Standard_GRS or - Standard_LRS to be created - displayName: Enforce storage account SKU - enforcementMode: Default - metadata: { assignedBy: Cheapskate Boss } - notScopes: [] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "This operation creates or updates the policy assignment - with the given ID. Policy assignments made on a scope apply to all resources - contained in that scope. For example, when you assign a policy to a resource - group that policy applies to all resources in the group. Policy assignment - IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.", name: CreateById, summary: Creates or updates a policy assignment. } - java: { description: "This operation creates or updates the policy assignment - with the given ID. Policy assignments made on a scope apply to all resources - contained in that scope. For example, when you assign a policy to a resource - group that policy applies to all resources in the group. Policy assignment - IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.", name: createById } - operationGroup: *id107 - operationId: PolicyAssignments_CreateById - parameters: - - *id013 - - &id188 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The ID of the policy assignment to create. Use the - format '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: policyAssignmentId, serializedName: policyAssignmentId } - java: { description: "The ID of the policy assignment to create. Use the format - '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: policyAssignmentId, serializedName: policyAssignmentId } - nullable: false - operation: *id187 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id189 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id187 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id188 - - *id189 - - &id190 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Parameters for policy assignment., name: parameters } - java: { description: Parameters for policy assignment., name: parameters } - nullable: false - operation: *id187 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id116 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id187 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /{policyAssignmentId} - uri: "{$host}" - signatureParameters: - - *id188 - - *id190 - responses: - - language: - default: - { - description: Created - Returns information about the policy assignment., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id116 - signatureParameters: - - *id188 - - &id191 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a policy assignment by ID: - parameters: - { - api-version: "2020-09-01", - policyAssignmentId: providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicyAssignmentById.json - responses: - "200": - body: - name: LowCostStorage - type: Microsoft.Authorization/policyAssignments - id: /providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage - properties: - description: Allow only storage accounts of SKU Standard_GRS or - Standard_LRS to be created - displayName: Enforce storage account SKU - enforcementMode: Default - metadata: { assignedBy: Cheapskate Boss } - notScopes: [] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - headers: {} - Retrieve a policy assignment with a managed identity by ID: - parameters: - { - api-version: "2020-09-01", - policyAssignmentId: providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicyAssignmentWithIdentityById.json - responses: - "200": - body: - name: LowCostStorage - type: Microsoft.Authorization/policyAssignments - id: /providers/Microsoft.Management/managementGroups/MyManagementGroup/providers/Microsoft.Authorization/policyAssignments/LowCostStorage - identity: - { - type: SystemAssigned, - principalId: e6d23f8d-af97-4fbc-bda6-00604e4e3d0a, - tenantId: 4bee2b8a-1bee-47c2-90e9-404241551135, - } - location: westus - properties: - description: Allow only storage accounts of SKU Standard_GRS or - Standard_LRS to be created - displayName: Enforce storage account SKU - enforcementMode: Default - metadata: { assignedBy: Cheapskate Boss } - notScopes: [] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "The operation retrieves the policy assignment with the - given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.", name: GetById, summary: Retrieves the policy assignment with the given ID. } - java: { description: "The operation retrieves the policy assignment with the - given ID. Policy assignment IDs have this format: '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'. - Valid scopes are: management group (format: '/providers/Microsoft.Management/managementGroups/{managementGroup}'), - subscription (format: '/subscriptions/{subscriptionId}'), resource group - (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}', - or resource (format: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/[{parentResourcePath}/]{resourceType}/{resourceName}'.", name: getById } - operationGroup: *id107 - operationId: PolicyAssignments_GetById - parameters: - - *id013 - - &id192 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The ID of the policy assignment to get. Use the format - '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: policyAssignmentId, serializedName: policyAssignmentId } - java: { description: "The ID of the policy assignment to get. Use the format - '{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}'.", name: policyAssignmentId, serializedName: policyAssignmentId } - nullable: false - operation: *id191 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id193 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id191 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id192 - - *id193 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id191 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "/{policyAssignmentId}", uri: "{$host}" } - signatureParameters: - - *id192 - responses: - - language: - default: - { description: OK - Returns information about the policy assignment., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id116 - signatureParameters: - - *id192 - - *id126 - - *id140 - - *id161 - - *id175 - protocol: {} - - &id194 - $key: PolicyDefinitions - codeModel: *id005 - language: - default: { description: "", name: PolicyDefinitions } - java: { description: "", name: PolicyDefinitions } - operations: - - &id195 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create or update a policy definition with advanced parameters: - parameters: - api-version: "2020-09-01" - parameters: - properties: - description: Audit enabling of logs and retain them up to a year. - This enables recreation of activity trails for investigation purposes - when a security incident occurs or your network is compromised - displayName: Event Hubs should have diagnostic logging enabled - metadata: { category: Event Hub } - mode: Indexed - parameters: - requiredRetentionDays: - type: Integer - allowedValues: [0, 30, 90, 180, 365] - defaultValue: 365 - metadata: { description: The required diagnostic logs retention - in days, displayName: Required retention (days) } - policyRule: - if: { equals: Microsoft.EventHub/namespaces, field: type } - then: - effect: AuditIfNotExists - details: - type: Microsoft.Insights/diagnosticSettings - existenceCondition: - allOf: - - { - equals: "true", - field: "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.enabled", - } - - { - equals: "[parameters('requiredRetentionDays')]", - field: "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.days", - } - policyDefinitionName: EventHubDiagnosticLogs - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createOrUpdatePolicyDefinitionAdvancedParams.json - responses: - "201": - body: - name: ResourceNaming - type: Microsoft.Authorization/policyDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - properties: - description: Audit enabling of logs and retain them up to a year. - This enables recreation of activity trails for investigation - purposes when a security incident occurs or your network is - compromised - displayName: Event Hubs should have diagnostic logging enabled - metadata: { category: Event Hub } - mode: Indexed - parameters: - requiredRetentionDays: - type: Integer - allowedValues: [0, 30, 90, 180, 365] - defaultValue: 365 - metadata: { description: The required diagnostic logs retention - in days, displayName: Required retention (days) } - policyRule: - if: { equals: Microsoft.EventHub/namespaces, field: type } - then: - effect: AuditIfNotExists - details: - type: Microsoft.Insights/diagnosticSettings - existenceCondition: - allOf: - - { - equals: "true", - field: "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.enabled", - } - - { - equals: "[parameters('requiredRetentionDays')]", - field: "Microsoft.Insights/diagnosticSettings/logs[*].retentionPolicy.days", - } - headers: {} - Create or update a policy definition: - parameters: - api-version: "2020-09-01" - parameters: - properties: - description: Force resource names to begin with given 'prefix' and/or - end with given 'suffix' - displayName: Enforce resource naming convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), '*', - parameters('suffix'))]" } - then: { effect: deny } - policyDefinitionName: ResourceNaming - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createOrUpdatePolicyDefinition.json - responses: - "201": - body: - name: ResourceNaming - type: Microsoft.Authorization/policyDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - properties: - description: Force resource names to begin with 'prefix' and end - with 'suffix' - displayName: Naming Convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), - '*', parameters('suffix'))]" } - then: { effect: deny } - policyType: Custom - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation creates or updates a policy definition - in the given subscription with the given name., name: CreateOrUpdate, summary: Creates - or updates a policy definition in a subscription. } - java: { description: This operation creates or updates a policy definition in - the given subscription with the given name., name: createOrUpdate } - operationGroup: *id194 - operationId: PolicyDefinitions_CreateOrUpdate - parameters: - - *id013 - - &id196 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy definition to create., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - java: - { - description: The name of the policy definition to create., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - nullable: false - operation: *id195 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id197 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id195 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id196 - - *id197 - - *id052 - - &id199 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The policy definition properties., name: parameters } - java: { description: The policy definition properties., name: parameters } - nullable: false - operation: *id195 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id200 - apiVersions: - - { version: "2020-09-01" } - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { description: The policy definition., name: PolicyDefinition, namespace: "" } - java: { description: The policy definition., name: PolicyDefinition } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id016 - immediate: - - *id016 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The policy definition properties., name: properties } - java: { description: The policy definition properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id383 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: true - language: - default: - { - description: The policy definition properties., - name: PolicyDefinitionProperties, - namespace: "", - } - java: - { - description: The policy definition properties., - name: PolicyDefinitionProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The type of policy definition. Possible - values are NotSpecified, BuiltIn, Custom, and Static.", name: policyType } - java: { description: "The type of policy definition. Possible values - are NotSpecified, BuiltIn, Custom, and Static.", name: policyType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id268 - apiVersions: - - { version: "2020-09-01" } - choiceType: *id017 - choices: - - language: - default: { description: "", name: NOT_SPECIFIED } - value: NotSpecified - - language: - default: { description: "", name: BUILT_IN } - value: BuiltIn - - language: - default: { description: "", name: CUSTOM } - value: Custom - - language: - default: { description: "", name: STATIC } - value: Static - language: - default: { description: "The type of policy definition. Possible - values are NotSpecified, BuiltIn, Custom, and Static.", name: PolicyType } - java: { description: "The type of policy definition. Possible values - are NotSpecified, BuiltIn, Custom, and Static.", name: PolicyType } - protocol: {} - type: CHOICE - serializedName: policyType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The policy definition mode. Some examples - are All, Indexed, Microsoft.KeyVault.Data.", name: mode } - java: { description: "The policy definition mode. Some examples are - All, Indexed, Microsoft.KeyVault.Data.", name: mode } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id425 - apiVersions: - - { version: "2020-09-01" } - defaultValue: Indexed - language: - default: { description: "The policy definition mode. Some examples - are All, Indexed, Microsoft.KeyVault.Data.", name: PolicyDefinitionPropertiesMode } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: mode - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The display name of the policy definition., - name: displayName, - } - java: - { - description: The display name of the policy definition., - name: displayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id426 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The display name of the policy definition., - name: PolicyDefinitionPropertiesDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The policy definition description., - name: description, - } - java: - { - description: The policy definition description., - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id427 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The policy definition description., - name: PolicyDefinitionPropertiesDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy rule., name: policyRule } - java: { description: The policy rule., name: policyRule } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: policyRule - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy definition metadata. Metadata - is an open ended object and is typically a collection of key - value pairs., name: metadata } - java: { description: The policy definition metadata. Metadata is - an open ended object and is typically a collection of key value - pairs., name: metadata } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: metadata - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The parameter definitions for parameters - used in the policy rule. The keys are the parameter names., name: parameters } - java: { description: The parameter definitions for parameters used - in the policy rule. The keys are the parameter names., name: parameters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id269 - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id384 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: { description: The definition of a parameter that can - be provided to the policy., name: ParameterDefinitionsValue, namespace: "" } - java: { description: The definition of a parameter that can be - provided to the policy., name: ParameterDefinitionsValue } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The data type of the parameter., name: type } - java: - { description: The data type of the parameter., name: type } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id366 - apiVersions: - - { version: "2020-09-01" } - choiceType: *id017 - choices: - - language: - default: { description: "", name: STRING } - value: String - - language: - default: { description: "", name: ARRAY } - value: Array - - language: - default: { description: "", name: OBJECT } - value: Object - - language: - default: { description: "", name: BOOLEAN } - value: Boolean - - language: - default: { description: "", name: INTEGER } - value: Integer - - language: - default: { description: "", name: FLOAT } - value: Float - - language: - default: { description: "", name: DATE_TIME } - value: DateTime - language: - default: - { - description: The data type of the parameter., - name: ParameterType, - } - java: - { - description: The data type of the parameter., - name: ParameterType, - } - protocol: {} - type: CHOICE - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The allowed values for the parameter., - name: allowedValues, - } - java: - { - description: The allowed values for the parameter., - name: allowedValues, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id352 - apiVersions: - - { version: "2020-09-01" } - elementType: *id018 - language: - default: - { - description: The allowed values for the parameter., - name: ParameterDefinitionsValueAllowedValues, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: allowedValues - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The default value for the parameter - if no value is provided., name: defaultValue } - java: { description: The default value for the parameter if - no value is provided., name: defaultValue } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: defaultValue - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: General metadata for the parameter., - name: metadata, - } - java: - { - description: General metadata for the parameter., - name: metadata, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id385 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: General metadata for the parameter., - name: ParameterDefinitionsValueMetadata, - namespace: "", - } - java: - { - description: General metadata for the parameter., - name: ParameterDefinitionsValueMetadata, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id198 - apiVersions: [] - elementType: *id018 - language: - default: - { - description: General metadata for the parameter., - name: ParameterDefinitionsValueMetadata, - } - java: - { - description: General metadata for the parameter., - name: ParameterDefinitionsValueMetadata, - } - protocol: {} - type: DICTIONARY - immediate: - - *id198 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The display name for the parameter., - name: displayName, - } - java: - { - description: The display name for the parameter., - name: displayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id428 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The display name for the parameter., - name: ParameterDefinitionsValueMetadataDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The description of the parameter., - name: description, - } - java: - { - description: The description of the parameter., - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id429 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The description of the parameter., - name: ParameterDefinitionsValueMetadataDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Used when assigning the policy - definition through the portal. Provides a context - aware list of values for the user to choose from., name: strongType } - java: - { - description: - Used when assigning the policy definition - through the portal. Provides a context aware list - of values for the user to choose from., - name: strongType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id430 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: Used when assigning the policy - definition through the portal. Provides a context - aware list of values for the user to choose from., name: ParameterDefinitionsValueMetadataStrongType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: strongType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Set to true to have Azure portal - create role assignments on the resource ID or resource - scope value of this parameter during policy assignment. - This property is useful in case you wish to assign - permissions outside the assignment scope., name: assignPermissions } - java: - { description: Set to true to have Azure portal create - role assignments on the resource ID or resource scope - value of this parameter during policy assignment. - This property is useful in case you wish to assign - permissions outside the assignment scope., name: assignPermissions } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id362 - apiVersions: [] - language: - default: - { description: Set to true to have Azure portal - create role assignments on the resource ID or resource - scope value of this parameter during policy assignment. - This property is useful in case you wish to assign - permissions outside the assignment scope., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: assignPermissions - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: metadata - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: The parameter definitions for parameters - used in the policy. The keys are the parameter names., name: ParameterDefinitions } - java: { description: The parameter definitions for parameters used - in the policy. The keys are the parameter names., name: ParameterDefinitions } - protocol: {} - type: DICTIONARY - serializedName: parameters - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id195 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} - uri: "{$host}" - signatureParameters: - - *id196 - - *id199 - responses: - - language: - default: - { - description: Created - Returns information about the policy definition., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id200 - signatureParameters: - - *id196 - - &id201 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete a policy definition: - parameters: - { - api-version: "2020-09-01", - policyDefinitionName: ResourceNaming, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/deletePolicyDefinition.json - responses: - "200": - headers: {} - "204": - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation deletes the policy definition in the given - subscription with the given name., name: Delete, summary: Deletes a policy - definition in a subscription. } - java: { description: This operation deletes the policy definition in the given - subscription with the given name., name: delete } - operationGroup: *id194 - operationId: PolicyDefinitions_Delete - parameters: - - *id013 - - &id202 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy definition to delete., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - java: - { - description: The name of the policy definition to delete., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - nullable: false - operation: *id201 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id203 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id201 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id202 - - *id203 - - *id052 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id201 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id202 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content, name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id202 - - &id204 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a policy definition: - parameters: - { - api-version: "2020-09-01", - policyDefinitionName: ResourceNaming, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicyDefinition.json - responses: - "200": - body: - name: ResourceNaming - type: Microsoft.Authorization/policyDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - properties: - description: Force resource names to begin with 'prefix' and end - with 'suffix' - displayName: Naming Convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), - '*', parameters('suffix'))]" } - then: { effect: deny } - policyType: Custom - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation retrieves the policy definition in the - given subscription with the given name., name: Get, summary: Retrieves a - policy definition in a subscription. } - java: { description: This operation retrieves the policy definition in the given - subscription with the given name., name: get } - operationGroup: *id194 - operationId: PolicyDefinitions_Get - parameters: - - *id013 - - &id205 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy definition to get., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - java: - { - description: The name of the policy definition to get., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - nullable: false - operation: *id204 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id206 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id204 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id205 - - *id206 - - *id052 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id204 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id205 - responses: - - language: - default: - { description: OK - Returns information about the policy definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id200 - signatureParameters: - - *id205 - - &id207 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a built-in policy definition: - parameters: - { - api-version: "2020-09-01", - policyDefinitionName: 7433c107-6db4-4ad1-b57a-a76dce0154a1, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getBuiltinPolicyDefinition.json - responses: - "200": - body: - name: 7433c107-6db4-4ad1-b57a-a76dce0154a1 - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - properties: - description: This policy enables you to specify a set of storage - account SKUs that your organization can deploy. - displayName: Allowed storage account SKUs - mode: All - parameters: - listOfAllowedSKUs: - type: Array - metadata: { description: The list of SKUs that can be specified - for storage accounts., displayName: Allowed SKUs, strongType: StorageSKUs } - policyRule: - if: - allOf: - - { equals: Microsoft.Storage/storageAccounts, field: type } - - not: - { - field: Microsoft.Storage/storageAccounts/sku.name, - in: "[parameters('listOfAllowedSKUs')]", - } - then: { effect: Deny } - policyType: BuiltIn - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation retrieves the built-in policy definition - with the given name., name: GetBuiltIn, summary: Retrieves a built-in policy - definition. } - java: { description: This operation retrieves the built-in policy definition - with the given name., name: getBuiltIn } - operationGroup: *id194 - operationId: PolicyDefinitions_GetBuiltIn - parameters: - - *id013 - - &id208 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the built-in policy definition to get., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - java: - { - description: The name of the built-in policy definition to get., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - nullable: false - operation: *id207 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id209 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id207 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id208 - - *id209 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id207 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id208 - responses: - - language: - default: { description: OK - Returns information about the built-in policy - definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id200 - signatureParameters: - - *id208 - - &id210 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create or update a policy definition at management group level: - parameters: - api-version: "2020-09-01" - managementGroupId: MyManagementGroup - parameters: - properties: - description: Force resource names to begin with given 'prefix' and/or - end with given 'suffix' - displayName: Enforce resource naming convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), '*', - parameters('suffix'))]" } - then: { effect: deny } - policyDefinitionName: ResourceNaming - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createOrUpdatePolicyDefinitionAtManagementGroup.json - responses: - "201": - body: - name: ResourceNaming - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - properties: - description: Force resource names to begin with 'prefix' and end - with 'suffix' - displayName: Naming Convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), - '*', parameters('suffix'))]" } - then: { effect: deny } - policyType: Custom - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation creates or updates a policy definition - in the given management group with the given name., name: CreateOrUpdateAtManagementGroup, summary: Creates or updates a policy definition in a management group. } - java: { description: This operation creates or updates a policy definition in - the given management group with the given name., name: createOrUpdateAtManagementGroup } - operationGroup: *id194 - operationId: PolicyDefinitions_CreateOrUpdateAtManagementGroup - parameters: - - *id013 - - &id211 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy definition to create., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - java: - { - description: The name of the policy definition to create., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - nullable: false - operation: *id210 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id212 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id210 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id213 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id210 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id211 - - *id212 - - *id213 - - &id214 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The policy definition properties., name: parameters } - java: { description: The policy definition properties., name: parameters } - nullable: false - operation: *id210 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id200 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id210 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName} - uri: "{$host}" - signatureParameters: - - *id211 - - *id213 - - *id214 - responses: - - language: - default: - { - description: Created - Returns information about the policy definition., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id200 - signatureParameters: - - *id211 - - *id213 - - &id215 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete a policy definition at management group level: - parameters: - { - api-version: "2020-09-01", - managementGroupId: MyManagementGroup, - policyDefinitionName: ResourceNaming, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/deletePolicyDefinitionAtManagementGroup.json - responses: - "200": - headers: {} - "204": - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation deletes the policy definition in the given - management group with the given name., name: DeleteAtManagementGroup, summary: Deletes - a policy definition in a management group. } - java: { description: This operation deletes the policy definition in the given - management group with the given name., name: deleteAtManagementGroup } - operationGroup: *id194 - operationId: PolicyDefinitions_DeleteAtManagementGroup - parameters: - - *id013 - - &id216 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy definition to delete., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - java: - { - description: The name of the policy definition to delete., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - nullable: false - operation: *id215 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id217 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id215 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id218 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id215 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id216 - - *id217 - - *id218 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id215 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: delete, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id216 - - *id218 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content, name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id216 - - *id218 - - &id219 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a policy definition at management group level: - parameters: - { - api-version: "2020-09-01", - managementGroupId: MyManagementGroup, - policyDefinitionName: ResourceNaming, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicyDefinitionAtManagementGroup.json - responses: - "200": - body: - name: ResourceNaming - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - properties: - description: Force resource names to begin with 'prefix' and end - with 'suffix' - displayName: Naming Convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), - '*', parameters('suffix'))]" } - then: { effect: deny } - policyType: Custom - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation retrieves the policy definition in the - given management group with the given name., name: GetAtManagementGroup, summary: Retrieve a policy definition in a management group. } - java: { description: This operation retrieves the policy definition in the given - management group with the given name., name: getAtManagementGroup } - operationGroup: *id194 - operationId: PolicyDefinitions_GetAtManagementGroup - parameters: - - *id013 - - &id220 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy definition to get., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - java: - { - description: The name of the policy definition to get., - name: policyDefinitionName, - serializedName: policyDefinitionName, - } - nullable: false - operation: *id219 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id221 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id219 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id222 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id219 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id220 - - *id221 - - *id222 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id219 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id220 - - *id222 - responses: - - language: - default: - { description: OK - Returns information about the policy definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id200 - signatureParameters: - - *id220 - - *id222 - - &id228 - apiVersions: &id223 - - { version: "2020-09-01" } - exceptions: &id224 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id225 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy definitions by subscription: - parameters: - { - api-version: "2020-09-01", - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicyDefinitions.json - responses: - "200": - body: - value: - - name: 7433c107-6db4-4ad1-b57a-a76dce0154a1 - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - properties: - description: This policy enables you to specify a set of storage - account SKUs that your organization can deploy. - displayName: Allowed storage account SKUs - mode: All - parameters: - listOfAllowedSKUs: - type: Array - metadata: { description: The list of SKUs that can be specified - for storage accounts., displayName: Allowed SKUs, strongType: StorageSKUs } - policyRule: - if: - allOf: - - { equals: Microsoft.Storage/storageAccounts, field: type } - - not: - { - field: Microsoft.Storage/storageAccounts/sku.name, - in: "[parameters('listOfAllowedSKUs')]", - } - then: { effect: Deny } - policyType: BuiltIn - - name: ResourceNaming - type: Microsoft.Authorization/policyDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - properties: - description: Force resource names to begin with 'prefix' and - end with 'suffix' - displayName: Naming Convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), - '*', parameters('suffix'))]" } - then: { effect: deny } - policyType: Custom - - name: AuditSoonToExpireCerts - type: Microsoft.Authorization/policyDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/AuditSoonToExpireCerts - properties: - description: Audit certificates that are stored in Azure Key - Vault, that expire within 'X' number of days. - displayName: Audit KeyVault certificates that expire within - specified number of days - metadata: { category: KeyVault DataPlane } - mode: Microsoft.KeyVault.Data - parameters: - daysToExpire: - type: Integer - metadata: { description: The number of days for a certificate - to expire., displayName: Days to expire } - policyRule: - if: - { - field: Microsoft.KeyVault.Data/vaults/certificates/attributes/expiresOn, - lessOrEquals: "[addDays(utcNow(), parameters('daysToExpire'))]", - } - then: { effect: audit } - policyType: Custom - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id227 - $key: listNext - apiVersions: *id223 - exceptions: *id224 - extensions: *id225 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id194 - parameters: [] - requests: - - language: &id230 - default: { description: "This operation retrieves a list of all the policy - definitions in a given subscription that match the optional given - $filter. Valid values for $filter are: 'atExactScope()', 'policyType - -eq {value}' or 'category eq '{value}''. If $filter is not - provided, the unfiltered list includes all policy definitions associated - with the subscription, including those that apply directly or from - management groups that contain the given subscription. If $filter=atExactScope() - is provided, the returned list only includes all policy definitions - that at the given subscription. If $filter='policyType -eq {value}' - is provided, the returned list only includes all policy definitions - whose type match the {value}. Possible policyType values are NotSpecified, - BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions - whose category match the {value}.", name: List, summary: Retrieves - policy definitions in a subscription } - java: { description: "This operation retrieves a list of all the policy - definitions in a given subscription that match the optional given - $filter. Valid values for $filter are: 'atExactScope()', 'policyType - -eq {value}' or 'category eq '{value}''. If $filter is not - provided, the unfiltered list includes all policy definitions associated - with the subscription, including those that apply directly or from - management groups that contain the given subscription. If $filter=atExactScope() - is provided, the returned list only includes all policy definitions - that at the given subscription. If $filter='policyType -eq {value}' - is provided, the returned list only includes all policy definitions - whose type match the {value}. Possible policyType values are NotSpecified, - BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions - whose category match the {value}.", name: list } - parameters: - - &id229 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id226 { name: nextLink, serializedName: nextLink } - java: *id226 - nullable: false - operation: *id227 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id234 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id228 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id229 - responses: &id235 - - language: - default: { description: OK - Returns an array of policy definitions., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id243 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: List of policy definitions., - name: PolicyDefinitionListResult, - namespace: "", - } - java: - { - description: List of policy definitions., - name: PolicyDefinitionListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An array of policy definitions., name: value } - java: { description: An array of policy definitions., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id353 - apiVersions: - - { version: "2020-09-01" } - elementType: *id200 - language: - default: - { - description: An array of policy definitions., - name: PolicyDefinitionListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The URL to use for getting the next set of - results., name: nextLink } - java: - { - description: The URL to use for getting the next set of results., - name: nextLink, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id431 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The URL to use for getting the next set - of results., name: PolicyDefinitionListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id230 - operationGroup: *id194 - operationId: PolicyDefinitions_List - parameters: - - *id013 - - &id231 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id228 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - - &id232 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - definitions whose type match the {value}. Possible policyType values are - NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions whose - category match the {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - definitions whose type match the {value}. Possible policyType values are - NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions whose - category match the {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id228 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id233 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id228 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id231 - - *id052 - - *id232 - - *id233 - - *id234 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions", - uri: "{$host}", - } - signatureParameters: - - *id232 - - *id233 - responses: *id235 - signatureParameters: - - *id232 - - *id233 - - &id241 - apiVersions: &id236 - - { version: "2020-09-01" } - exceptions: &id237 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id238 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List built-in policy definitions: - parameters: { api-version: "2020-09-01" } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listBuiltInPolicyDefinitions.json - responses: - "200": - body: - value: - - name: 06a78e20-9358-41c9-923c-fb736d382a12 - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Authorization/policyDefinitions/06a78e20-9358-41c9-923c-fb736d382a12 - properties: - description: Audit DB level audit setting for SQL databases - displayName: Audit SQL DB Level Audit Setting - mode: All - parameters: - setting: - type: String - allowedValues: [enabled, disabled] - metadata: { displayName: Audit Setting } - policyRule: - if: { equals: Microsoft.Sql/servers/databases, field: type } - then: - effect: AuditIfNotExists - details: - name: default - type: Microsoft.Sql/servers/databases/auditingSettings - existenceCondition: - allOf: - - { - equals: "[parameters('setting')]", - field: Microsoft.Sql/auditingSettings.state, - } - policyType: BuiltIn - - name: 7433c107-6db4-4ad1-b57a-a76dce0154a1 - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - properties: - description: This policy enables you to specify a set of storage - account SKUs that your organization can deploy. - displayName: Allowed storage account SKUs - mode: All - parameters: - listOfAllowedSKUs: - type: Array - metadata: { description: The list of SKUs that can be specified - for storage accounts., displayName: Allowed SKUs, strongType: StorageSKUs } - policyRule: - if: - allOf: - - { equals: Microsoft.Storage/storageAccounts, field: type } - - not: - { - field: Microsoft.Storage/storageAccounts/sku.name, - in: "[parameters('listOfAllowedSKUs')]", - } - then: { effect: Deny } - policyType: Static - - name: abeed54a-73c5-441d-8a8c-6b5e7a0c299e - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Authorization/policyDefinitions/abeed54a-73c5-441d-8a8c-6b5e7a0c299e - properties: - description: Audit certificates that are stored in Azure Key - Vault, that expire within 'X' number of days. - displayName: Audit KeyVault certificates that expire within - specified number of days - metadata: { category: KeyVault DataPlane } - mode: Microsoft.KeyVault.Data - parameters: - daysToExpire: - type: Integer - metadata: { description: The number of days for a certificate - to expire., displayName: Days to expire } - policyRule: - if: - { - field: Microsoft.KeyVault.Data/vaults/certificates/attributes/expiresOn, - lessOrEquals: "[addDays(utcNow(), parameters('daysToExpire'))]", - } - then: { effect: audit } - policyType: BuiltIn - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id240 - $key: listBuiltInNext - apiVersions: *id236 - exceptions: *id237 - extensions: *id238 - language: - java: { description: Get the next page of items, name: listBuiltInNext } - operationGroup: *id194 - parameters: [] - requests: - - language: &id244 - default: { description: "This operation retrieves a list of all the built-in - policy definitions that match the optional given $filter. If $filter='policyType - -eq {value}' is provided, the returned list only includes all built-in - policy definitions whose type match the {value}. Possible policyType - values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category - -eq {value}' is provided, the returned list only includes all built-in - policy definitions whose category match the {value}.", name: ListBuiltIn, summary: Retrieve built-in policy definitions } - java: { description: "This operation retrieves a list of all the built-in - policy definitions that match the optional given $filter. If $filter='policyType - -eq {value}' is provided, the returned list only includes all built-in - policy definitions whose type match the {value}. Possible policyType - values are NotSpecified, BuiltIn, Custom, and Static. If $filter='category - -eq {value}' is provided, the returned list only includes all built-in - policy definitions whose category match the {value}.", name: listBuiltIn } - parameters: - - &id242 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id239 { name: nextLink, serializedName: nextLink } - java: *id239 - nullable: false - operation: *id240 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id248 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id241 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id242 - responses: &id249 - - language: - default: - { - description: OK - Returns an array of built-in policy definitions., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id243 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id244 - operationGroup: *id194 - operationId: PolicyDefinitions_ListBuiltIn - parameters: - - *id013 - - &id245 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id241 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id246 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - definitions whose type match the {value}. Possible policyType values are - NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions whose - category match the {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - definitions whose type match the {value}. Possible policyType values are - NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions whose - category match the {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id241 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id247 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id241 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id245 - - *id246 - - *id247 - - *id248 - protocol: - http: - { - explode: false, - method: get, - path: /providers/Microsoft.Authorization/policyDefinitions, - uri: "{$host}", - } - signatureParameters: - - *id246 - - *id247 - responses: *id249 - signatureParameters: - - *id246 - - *id247 - - &id255 - apiVersions: &id250 - - { version: "2020-09-01" } - exceptions: &id251 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id252 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy definitions by management group: - parameters: { api-version: "2020-09-01", managementGroupId: MyManagementGroup } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicyDefinitionsByManagementGroup.json - responses: - "200": - body: - value: - - name: 7433c107-6db4-4ad1-b57a-a76dce0154a1 - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - properties: - description: This policy enables you to specify a set of storage - account SKUs that your organization can deploy. - displayName: Allowed storage account SKUs - mode: All - parameters: - listOfAllowedSKUs: - type: Array - metadata: { description: The list of SKUs that can be specified - for storage accounts., displayName: Allowed SKUs, strongType: StorageSKUs } - policyRule: - if: - allOf: - - { equals: Microsoft.Storage/storageAccounts, field: type } - - not: - { - field: Microsoft.Storage/storageAccounts/sku.name, - in: "[parameters('listOfAllowedSKUs')]", - } - then: { effect: Deny } - policyType: BuiltIn - - name: ResourceNaming - type: Microsoft.Authorization/policyDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - properties: - description: Force resource names to begin with 'prefix' and - end with 'suffix' - displayName: Naming Convention - metadata: { category: Naming } - mode: All - parameters: - prefix: - type: String - metadata: { description: Resource name prefix, displayName: Prefix } - suffix: - type: String - metadata: { description: Resource name suffix, displayName: Suffix } - policyRule: - if: - not: { field: name, like: "[concat(parameters('prefix'), - '*', parameters('suffix'))]" } - then: { effect: deny } - policyType: Custom - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id254 - $key: listByManagementGroupNext - apiVersions: *id250 - exceptions: *id251 - extensions: *id252 - language: - java: { description: Get the next page of items, name: listByManagementGroupNext } - operationGroup: *id194 - parameters: [] - requests: - - language: &id257 - default: { description: "This operation retrieves a list of all the policy - definitions in a given management group that match the optional - given $filter. Valid values for $filter are: 'atExactScope()', - 'policyType -eq {value}' or 'category eq '{value}''. If $filter - is not provided, the unfiltered list includes all policy definitions - associated with the management group, including those that apply - directly or from management groups that contain the given management - group. If $filter=atExactScope() is provided, the returned list - only includes all policy definitions that at the given management - group. If $filter='policyType -eq {value}' is provided, the returned - list only includes all policy definitions whose type match the {value}. - Possible policyType values are NotSpecified, BuiltIn, Custom, and - Static. If $filter='category -eq {value}' is provided, the returned - list only includes all policy definitions whose category match the - {value}.", name: ListByManagementGroup, summary: Retrieve policy - definitions in a management group } - java: { description: "This operation retrieves a list of all the policy - definitions in a given management group that match the optional - given $filter. Valid values for $filter are: 'atExactScope()', - 'policyType -eq {value}' or 'category eq '{value}''. If $filter - is not provided, the unfiltered list includes all policy definitions - associated with the management group, including those that apply - directly or from management groups that contain the given management - group. If $filter=atExactScope() is provided, the returned list - only includes all policy definitions that at the given management - group. If $filter='policyType -eq {value}' is provided, the returned - list only includes all policy definitions whose type match the {value}. - Possible policyType values are NotSpecified, BuiltIn, Custom, and - Static. If $filter='category -eq {value}' is provided, the returned - list only includes all policy definitions whose category match the - {value}.", name: listByManagementGroup } - parameters: - - &id256 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id253 { name: nextLink, serializedName: nextLink } - java: *id253 - nullable: false - operation: *id254 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id262 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id255 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id256 - responses: &id263 - - language: - default: { description: OK - Returns an array of policy definitions., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id243 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id257 - operationGroup: *id194 - operationId: PolicyDefinitions_ListByManagementGroup - parameters: - - *id013 - - &id258 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id255 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id259 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id255 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - - &id260 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - definitions whose type match the {value}. Possible policyType values are - NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions whose - category match the {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - definitions whose type match the {value}. Possible policyType values are - NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq {value}' - is provided, the returned list only includes all policy definitions whose - category match the {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id255 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id261 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id255 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id258 - - *id259 - - *id260 - - *id261 - - *id262 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - uri: "{$host}", - } - signatureParameters: - - *id259 - - *id260 - - *id261 - responses: *id263 - signatureParameters: - - *id259 - - *id260 - - *id261 - - *id227 - - *id240 - - *id254 - protocol: {} - - &id264 - $key: PolicySetDefinitions - codeModel: *id005 - language: - default: { description: "", name: PolicySetDefinitions } - java: { description: "", name: PolicySetDefinitions } - operations: - - &id265 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create or update a policy set definition with groups: - parameters: - api-version: "2020-09-01" - parameters: - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitionGroups: - - { name: CostSaving, description: Policies designed to control spend - within a subscription., displayName: Cost Management Policies } - - { name: Organizational, description: Policies that help enforce - resource organization standards within a subscription., displayName: Organizational - Policies } - policyDefinitions: - - groupNames: [CostSaving] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - groupNames: [Organizational] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - policySetDefinitionName: CostManagement - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createOrUpdatePolicySetDefinitionWithGroups.json - responses: - "200": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitionGroups: - - { name: CostSaving, description: Policies designed to control - spend within a subscription., displayName: Cost Management - Policies } - - { name: Organizational, description: Policies that help enforce - resource organization standards within a subscription., displayName: Organizational - Policies } - policyDefinitions: - - groupNames: [CostSaving] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - groupNames: [Organizational] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - "201": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitionGroups: - - { name: CostSaving, description: Policies designed to control - spend within a subscription., displayName: Cost Management - Policies } - - { name: Organizational, description: Policies that help enforce - resource organization standards within a subscription., displayName: Organizational - Policies } - policyDefinitions: - - groupNames: [CostSaving] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - groupNames: [Organizational] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - Create or update a policy set definition: - parameters: - api-version: "2020-09-01" - parameters: - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - parameters: - namePrefix: - type: String - defaultValue: myPrefix - metadata: { displayName: Prefix to enforce on resource names } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: "[parameters('namePrefix')]" } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - policySetDefinitionName: CostManagement - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2 - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createOrUpdatePolicySetDefinition.json - responses: - "200": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - parameters: - namePrefix: - type: String - defaultValue: myPrefix - metadata: { displayName: Prefix to enforce on resource names } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: "[parameters('namePrefix')]" } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - "201": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - parameters: - namePrefix: - type: String - defaultValue: myPrefix - metadata: { displayName: Prefix to enforce on resource names } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: "[parameters('namePrefix')]" } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation creates or updates a policy set definition - in the given subscription with the given name., name: CreateOrUpdate, summary: Creates - or updates a policy set definition. } - java: { description: This operation creates or updates a policy set definition - in the given subscription with the given name., name: createOrUpdate } - operationGroup: *id264 - operationId: PolicySetDefinitions_CreateOrUpdate - parameters: - - *id013 - - &id266 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy set definition to create., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - java: - { - description: The name of the policy set definition to create., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - nullable: false - operation: *id265 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id267 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id265 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id266 - - *id267 - - *id052 - - &id271 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The policy set definition properties., name: parameters } - java: { description: The policy set definition properties., name: parameters } - nullable: false - operation: *id265 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id272 - apiVersions: - - { version: "2020-09-01" } - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: - { - description: The policy set definition., - name: PolicySetDefinition, - namespace: "", - } - java: { description: The policy set definition., name: PolicySetDefinition } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id016 - immediate: - - *id016 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The policy definition properties., name: properties } - java: { description: The policy definition properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id386 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: true - language: - default: - { - description: The policy set definition properties., - name: PolicySetDefinitionProperties, - namespace: "", - } - java: - { - description: The policy set definition properties., - name: PolicySetDefinitionProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The type of policy definition. Possible - values are NotSpecified, BuiltIn, Custom, and Static.", name: policyType } - java: { description: "The type of policy definition. Possible values - are NotSpecified, BuiltIn, Custom, and Static.", name: policyType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id268 - serializedName: policyType - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The display name of the policy set definition., - name: displayName, - } - java: - { - description: The display name of the policy set definition., - name: displayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id432 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The display name of the policy set definition., - name: PolicySetDefinitionPropertiesDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The policy set definition description., - name: description, - } - java: - { - description: The policy set definition description., - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id433 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The policy set definition description., - name: PolicySetDefinitionPropertiesDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy set definition metadata. Metadata - is an open ended object and is typically a collection of key - value pairs., name: metadata } - java: { description: The policy set definition metadata. Metadata - is an open ended object and is typically a collection of key - value pairs., name: metadata } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: metadata - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The policy set definition parameters that - can be used in policy definition references., name: parameters } - java: { description: The policy set definition parameters that can - be used in policy definition references., name: parameters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id269 - serializedName: parameters - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: An array of policy definition references., - name: policyDefinitions, - } - java: - { - description: An array of policy definition references., - name: policyDefinitions, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id355 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id387 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: The policy definition reference., - name: PolicyDefinitionReference, - namespace: "", - } - java: - { - description: The policy definition reference., - name: PolicyDefinitionReference, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The ID of the policy definition or - policy set definition., name: policyDefinitionId } - java: { description: The ID of the policy definition or policy - set definition., name: policyDefinitionId } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id434 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The ID of the policy definition or - policy set definition., name: PolicyDefinitionReferencePolicyDefinitionId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: policyDefinitionId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The parameter values for the referenced - policy rule. The keys are the parameter names., name: parameters } - java: { description: The parameter values for the referenced - policy rule. The keys are the parameter names., name: parameters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id270 - serializedName: parameters - - apiVersions: [] - isDiscriminator: false - language: - default: { description: A unique id (within the policy set - definition) for this policy definition reference., name: policyDefinitionReferenceId } - java: - { - description: - A unique id (within the policy set definition) - for this policy definition reference., - name: policyDefinitionReferenceId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id435 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: A unique id (within the policy set - definition) for this policy definition reference., name: PolicyDefinitionReferencePolicyDefinitionReferenceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: policyDefinitionReferenceId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The name of the groups that this policy - definition reference belongs to., name: groupNames } - java: { description: The name of the groups that this policy - definition reference belongs to., name: groupNames } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id354 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id436 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: "", - name: PolicyDefinitionReferenceGroupNamesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The name of the groups that this - policy definition reference belongs to., name: PolicyDefinitionReferenceGroupNames } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: groupNames - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: An array of policy definition references., - name: PolicySetDefinitionPropertiesPolicyDefinitions, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: policyDefinitions - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The metadata describing groups of policy - definition references within the policy set definition., name: policyDefinitionGroups } - java: - { description: The metadata describing groups of policy definition - references within the policy set definition., name: policyDefinitionGroups } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id356 - apiVersions: - - { version: "2020-09-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id388 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: The policy definition group., - name: PolicyDefinitionGroup, - namespace: "", - } - java: - { - description: The policy definition group., - name: PolicyDefinitionGroup, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The name of the group., name: name } - java: { description: The name of the group., name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id437 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The name of the group., - name: PolicyDefinitionGroupName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The group's display name., - name: displayName, - } - java: - { - description: The group's display name., - name: displayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id438 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The group's display name., - name: PolicyDefinitionGroupDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The group's category., name: category } - java: { description: The group's category., name: category } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id439 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The group's category., - name: PolicyDefinitionGroupCategory, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: category - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The group's description., name: description } - java: - { description: The group's description., name: description } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id440 - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The group's description., - name: PolicyDefinitionGroupDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A resource ID of a resource that contains - additional metadata about the group., name: additionalMetadataId } - java: { description: A resource ID of a resource that contains - additional metadata about the group., name: additionalMetadataId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id441 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: A resource ID of a resource that - contains additional metadata about the group., name: PolicyDefinitionGroupAdditionalMetadataId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: additionalMetadataId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: The metadata describing groups of policy - definition references within the policy set definition., name: PolicySetDefinitionPropertiesPolicyDefinitionGroups } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: policyDefinitionGroups - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id265 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} - uri: "{$host}" - signatureParameters: - - *id266 - - *id271 - responses: - - language: - default: - { description: OK - Returns information about the policy set definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id272 - - language: - default: { description: Created - Returns information about the policy set - definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id272 - signatureParameters: - - *id266 - - &id273 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete a policy set definition: - parameters: - { - api-version: "2020-09-01", - policySetDefinitionName: CostManagement, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/deletePolicySetDefinition.json - responses: - "200": - headers: {} - "204": - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation deletes the policy set definition in the - given subscription with the given name., name: Delete, summary: Deletes - a policy set definition. } - java: { description: This operation deletes the policy set definition in the - given subscription with the given name., name: delete } - operationGroup: *id264 - operationId: PolicySetDefinitions_Delete - parameters: - - *id013 - - &id274 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy set definition to delete., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - java: - { - description: The name of the policy set definition to delete., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - nullable: false - operation: *id273 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id275 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id273 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id274 - - *id275 - - *id052 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id273 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id274 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content - the policy set definition doesn't exist - in the subscription., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id274 - - &id276 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a policy set definition: - parameters: - { - api-version: "2020-09-01", - policySetDefinitionName: CostManagement, - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicySetDefinition.json - responses: - "200": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitionGroups: - - { name: CostSaving, description: Policies designed to control - spend within a subscription., displayName: Cost Management - Policies } - - { name: Organizational, description: Policies that help enforce - resource organization standards within a subscription., displayName: Organizational - Policies } - policyDefinitions: - - groupNames: [CostSaving] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - groupNames: [Organizational] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation retrieves the policy set definition in - the given subscription with the given name., name: Get, summary: Retrieves - a policy set definition. } - java: { description: This operation retrieves the policy set definition in the - given subscription with the given name., name: get } - operationGroup: *id264 - operationId: PolicySetDefinitions_Get - parameters: - - *id013 - - &id277 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy set definition to get., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - java: - { - description: The name of the policy set definition to get., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - nullable: false - operation: *id276 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id278 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id276 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id277 - - *id278 - - *id052 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id276 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id277 - responses: - - language: - default: - { description: OK - Returns information about the policy set definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id272 - signatureParameters: - - *id277 - - &id279 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a built-in policy set definition: - parameters: - { - api-version: "2020-09-01", - policySetDefinitionName: 1f3afdf9-d0c9-4c3d-847f-89da613e70a8, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getBuiltInPolicySetDefinition.json - responses: - "200": - body: - name: 1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - properties: - description: Monitor all the available security recommendations - in Azure Security Center. This is the default policy for Azure - Security Center. - displayName: "[Preview]: Enable Monitoring in Azure Security Center" - metadata: { category: Security Center } - parameters: {} - policyDefinitions: - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/a8bef009-a5c9-4d0f-90d7-6018734e8a16, - policyDefinitionReferenceId: RefId1, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af8051bf-258b-44e2-a2bf-165330459f9d, - policyDefinitionReferenceId: RefId2, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/86b3d65f-7626-441e-b690-81a8b71cff60, - policyDefinitionReferenceId: RefId3, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/655cb504-bcee-4362-bd4c-402e6aa38759, - policyDefinitionReferenceId: RefId4, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/b0f33259-77d7-4c9e-aac6-3aabcfae693c, - policyDefinitionReferenceId: RefId5, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/47a6b606-51aa-4496-8bb7-64b11cf66adc, - policyDefinitionReferenceId: RefId6, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/44452482-524f-4bf4-b852-0bff7cc4a3ed, - policyDefinitionReferenceId: RefId7, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/e1e5fd5d-3e4c-4ce1-8661-7d1873ae6b15, - policyDefinitionReferenceId: RefId8, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af6cd1bd-1635-48cb-bde7-5b15693900b9, - policyDefinitionReferenceId: RefId9, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/0961003e-5a0a-4549-abde-af6a37f2724d, - policyDefinitionReferenceId: RefId10, - } - policyType: BuiltIn - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation retrieves the built-in policy set definition - with the given name., name: GetBuiltIn, summary: Retrieves a built in policy - set definition. } - java: { description: This operation retrieves the built-in policy set definition - with the given name., name: getBuiltIn } - operationGroup: *id264 - operationId: PolicySetDefinitions_GetBuiltIn - parameters: - - *id013 - - &id280 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy set definition to get., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - java: - { - description: The name of the policy set definition to get., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - nullable: false - operation: *id279 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id281 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id279 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id280 - - *id281 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id279 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id280 - responses: - - language: - default: { description: OK - Returns information about the built in policy - set definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id272 - signatureParameters: - - *id280 - - &id287 - apiVersions: &id282 - - { version: "2020-09-01" } - exceptions: &id283 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id284 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy set definitions: - parameters: - { - api-version: "2020-09-01", - subscriptionId: ae640e6b-ba3e-4256-9d62-2993eecfa6f2, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicySetDefinitions.json - responses: - "200": - body: - value: - - name: 1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - properties: - description: Monitor all the available security recommendations - in Azure Security Center. This is the default policy for Azure - Security Center. - displayName: "[Preview]: Enable Monitoring in Azure Security - Center" - metadata: { category: Security Center } - parameters: {} - policyDefinitions: - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/a8bef009-a5c9-4d0f-90d7-6018734e8a16, - policyDefinitionReferenceId: RefId1, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af8051bf-258b-44e2-a2bf-165330459f9d, - policyDefinitionReferenceId: RefId2, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/86b3d65f-7626-441e-b690-81a8b71cff60, - policyDefinitionReferenceId: RefId3, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/655cb504-bcee-4362-bd4c-402e6aa38759, - policyDefinitionReferenceId: RefId4, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/b0f33259-77d7-4c9e-aac6-3aabcfae693c, - policyDefinitionReferenceId: RefId5, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/47a6b606-51aa-4496-8bb7-64b11cf66adc, - policyDefinitionReferenceId: RefId6, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/44452482-524f-4bf4-b852-0bff7cc4a3ed, - policyDefinitionReferenceId: RefId7, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/e1e5fd5d-3e4c-4ce1-8661-7d1873ae6b15, - policyDefinitionReferenceId: RefId8, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af6cd1bd-1635-48cb-bde7-5b15693900b9, - policyDefinitionReferenceId: RefId9, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/0961003e-5a0a-4549-abde-af6a37f2724d, - policyDefinitionReferenceId: RefId10, - } - policyType: BuiltIn - - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id286 - $key: listNext - apiVersions: *id282 - exceptions: *id283 - extensions: *id284 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id264 - parameters: [] - requests: - - language: &id289 - default: { description: "This operation retrieves a list of all the policy - set definitions in a given subscription that match the optional - given $filter. Valid values for $filter are: 'atExactScope()', - 'policyType -eq {value}' or 'category eq '{value}''. If $filter - is not provided, the unfiltered list includes all policy set definitions - associated with the subscription, including those that apply directly - or from management groups that contain the given subscription. If - $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given subscription. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType - values are NotSpecified, BuiltIn and Custom. If $filter='category - -eq {value}' is provided, the returned list only includes all policy - set definitions whose category match the {value}.", name: List, summary: Retrieves the policy set definitions for a subscription. } - java: { description: "This operation retrieves a list of all the policy - set definitions in a given subscription that match the optional - given $filter. Valid values for $filter are: 'atExactScope()', - 'policyType -eq {value}' or 'category eq '{value}''. If $filter - is not provided, the unfiltered list includes all policy set definitions - associated with the subscription, including those that apply directly - or from management groups that contain the given subscription. If - $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given subscription. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType - values are NotSpecified, BuiltIn and Custom. If $filter='category - -eq {value}' is provided, the returned list only includes all policy - set definitions whose category match the {value}.", name: list } - parameters: - - &id288 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id285 { name: nextLink, serializedName: nextLink } - java: *id285 - nullable: false - operation: *id286 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id293 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id287 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id288 - responses: &id294 - - language: - default: - { description: OK - Returns an array of policy set definitions., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id302 - apiVersions: - - { version: "2020-09-01" } - flattenedSchema: false - language: - default: - { - description: List of policy set definitions., - name: PolicySetDefinitionListResult, - namespace: "", - } - java: - { - description: List of policy set definitions., - name: PolicySetDefinitionListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An array of policy set definitions., name: value } - java: { description: An array of policy set definitions., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id357 - apiVersions: - - { version: "2020-09-01" } - elementType: *id272 - language: - default: - { - description: An array of policy set definitions., - name: PolicySetDefinitionListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The URL to use for getting the next set of - results., name: nextLink } - java: - { - description: The URL to use for getting the next set of results., - name: nextLink, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id442 - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The URL to use for getting the next set - of results., name: PolicySetDefinitionListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id289 - operationGroup: *id264 - operationId: PolicySetDefinitions_List - parameters: - - *id013 - - &id290 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id287 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - *id052 - - &id291 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType values - are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq - {value}' is provided, the returned list only includes all policy set - definitions whose category match the {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType values - are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq - {value}' is provided, the returned list only includes all policy set - definitions whose category match the {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id287 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id292 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id287 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id290 - - *id052 - - *id291 - - *id292 - - *id293 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions", - uri: "{$host}", - } - signatureParameters: - - *id291 - - *id292 - responses: *id294 - signatureParameters: - - *id291 - - *id292 - - &id300 - apiVersions: &id295 - - { version: "2020-09-01" } - exceptions: &id296 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id297 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List built-in policy set definitions: - parameters: { api-version: "2020-09-01" } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listBuiltInPolicySetDefinitions.json - responses: - "200": - body: - value: - - name: 1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - properties: - description: Monitor all the available security recommendations - in Azure Security Center. This is the default policy for Azure - Security Center. - displayName: "[Preview]: Enable Monitoring in Azure Security - Center" - metadata: { category: Security Center } - parameters: {} - policyDefinitions: - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/a8bef009-a5c9-4d0f-90d7-6018734e8a16, - policyDefinitionReferenceId: RefId1, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af8051bf-258b-44e2-a2bf-165330459f9d, - policyDefinitionReferenceId: RefId2, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/86b3d65f-7626-441e-b690-81a8b71cff60, - policyDefinitionReferenceId: RefId3, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/655cb504-bcee-4362-bd4c-402e6aa38759, - policyDefinitionReferenceId: RefId4, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/b0f33259-77d7-4c9e-aac6-3aabcfae693c, - policyDefinitionReferenceId: RefId5, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/47a6b606-51aa-4496-8bb7-64b11cf66adc, - policyDefinitionReferenceId: RefId6, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/44452482-524f-4bf4-b852-0bff7cc4a3ed, - policyDefinitionReferenceId: RefId7, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/e1e5fd5d-3e4c-4ce1-8661-7d1873ae6b15, - policyDefinitionReferenceId: RefId8, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af6cd1bd-1635-48cb-bde7-5b15693900b9, - policyDefinitionReferenceId: RefId9, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/0961003e-5a0a-4549-abde-af6a37f2724d, - policyDefinitionReferenceId: RefId10, - } - policyType: BuiltIn - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id299 - $key: listBuiltInNext - apiVersions: *id295 - exceptions: *id296 - extensions: *id297 - language: - java: { description: Get the next page of items, name: listBuiltInNext } - operationGroup: *id264 - parameters: [] - requests: - - language: &id303 - default: { description: "This operation retrieves a list of all the built-in - policy set definitions that match the optional given $filter. If - $filter='category -eq {value}' is provided, the returned list - only includes all built-in policy set definitions whose category - match the {value}.", name: ListBuiltIn, summary: Retrieves built-in - policy set definitions. } - java: { description: "This operation retrieves a list of all the built-in - policy set definitions that match the optional given $filter. If - $filter='category -eq {value}' is provided, the returned list - only includes all built-in policy set definitions whose category - match the {value}.", name: listBuiltIn } - parameters: - - &id301 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id298 { name: nextLink, serializedName: nextLink } - java: *id298 - nullable: false - operation: *id299 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id307 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id300 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id301 - responses: &id308 - - language: - default: { description: OK - Returns an array of built in policy set - definitions., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id302 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id303 - operationGroup: *id264 - operationId: PolicySetDefinitions_ListBuiltIn - parameters: - - *id013 - - &id304 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id300 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id305 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType values - are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq - {value}' is provided, the returned list only includes all policy set - definitions whose category match the {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType values - are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq - {value}' is provided, the returned list only includes all policy set - definitions whose category match the {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id300 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id306 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id300 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id304 - - *id305 - - *id306 - - *id307 - protocol: - http: - { - explode: false, - method: get, - path: /providers/Microsoft.Authorization/policySetDefinitions, - uri: "{$host}", - } - signatureParameters: - - *id305 - - *id306 - responses: *id308 - signatureParameters: - - *id305 - - *id306 - - &id309 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Create or update a policy set definition with groups at management group level: - parameters: - api-version: "2020-09-01" - managementGroupId: MyManagementGroup - parameters: - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitionGroups: - - { name: CostSaving, description: Policies designed to control spend - within a subscription., displayName: Cost Management Policies } - - { name: Organizational, description: Policies that help enforce - resource organization standards within a subscription., displayName: Organizational - Policies } - policyDefinitions: - - groupNames: [CostSaving] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - groupNames: [Organizational] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - policySetDefinitionName: CostManagement - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createOrUpdatePolicySetDefinitionWithGroupsAtManagementGroup.json - responses: - "200": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitionGroups: - - { name: CostSaving, description: Policies designed to control - spend within a subscription., displayName: Cost Management - Policies } - - { name: Organizational, description: Policies that help enforce - resource organization standards within a subscription., displayName: Organizational - Policies } - policyDefinitions: - - groupNames: [CostSaving] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - groupNames: [Organizational] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - "201": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitionGroups: - - { name: CostSaving, description: Policies designed to control - spend within a subscription., displayName: Cost Management - Policies } - - { name: Organizational, description: Policies that help enforce - resource organization standards within a subscription., displayName: Organizational - Policies } - policyDefinitions: - - groupNames: [CostSaving] - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - groupNames: [Organizational] - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /subscriptions/ae640e6b-ba3e-4256-9d62-2993eecfa6f2/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - Create or update a policy set definition at management group level: - parameters: - api-version: "2020-09-01" - managementGroupId: MyManagementGroup - parameters: - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - policySetDefinitionName: CostManagement - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/createOrUpdatePolicySetDefinitionAtManagementGroup.json - responses: - "200": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - "201": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation creates or updates a policy set definition - in the given management group with the given name., name: CreateOrUpdateAtManagementGroup, summary: Creates or updates a policy set definition. } - java: { description: This operation creates or updates a policy set definition - in the given management group with the given name., name: createOrUpdateAtManagementGroup } - operationGroup: *id264 - operationId: PolicySetDefinitions_CreateOrUpdateAtManagementGroup - parameters: - - *id013 - - &id310 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy set definition to create., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - java: - { - description: The name of the policy set definition to create., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - nullable: false - operation: *id309 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id311 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id309 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id312 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id309 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id310 - - *id311 - - *id312 - - &id313 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The policy set definition properties., name: parameters } - java: { description: The policy set definition properties., name: parameters } - nullable: false - operation: *id309 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id272 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id309 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName} - uri: "{$host}" - signatureParameters: - - *id310 - - *id312 - - *id313 - responses: - - language: - default: - { description: OK - Returns information about the policy set definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id272 - - language: - default: { description: Created - Returns information about the policy set - definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id272 - signatureParameters: - - *id310 - - *id312 - - &id314 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Delete a policy set definition at management group level: - parameters: - { - api-version: "2020-09-01", - managementGroupId: MyManagementGroup, - policySetDefinitionName: CostManagement, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/deletePolicySetDefinitionAtManagementGroup.json - responses: - "200": - headers: {} - "204": - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation deletes the policy set definition in the - given management group with the given name., name: DeleteAtManagementGroup, summary: Deletes a policy set definition. } - java: { description: This operation deletes the policy set definition in the - given management group with the given name., name: deleteAtManagementGroup } - operationGroup: *id264 - operationId: PolicySetDefinitions_DeleteAtManagementGroup - parameters: - - *id013 - - &id315 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy set definition to delete., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - java: - { - description: The name of the policy set definition to delete., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - nullable: false - operation: *id314 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id316 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id314 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id317 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id314 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id315 - - *id316 - - *id317 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id314 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: delete, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id315 - - *id317 - responses: - - language: - default: { description: OK, name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content - the policy set definition doesn't exist - in the subscription., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id315 - - *id317 - - &id318 - apiVersions: - - { version: "2020-09-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Retrieve a policy set definition at management group level: - parameters: - { - api-version: "2020-09-01", - managementGroupId: MyManagementGroup, - policySetDefinitionName: CostManagement, - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/getPolicySetDefinitionAtManagementGroup.json - responses: - "200": - body: - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: This operation retrieves the policy set definition in - the given management group with the given name., name: GetAtManagementGroup, summary: Retrieves a policy set definition. } - java: { description: This operation retrieves the policy set definition in the - given management group with the given name., name: getAtManagementGroup } - operationGroup: *id264 - operationId: PolicySetDefinitions_GetAtManagementGroup - parameters: - - *id013 - - &id319 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the policy set definition to get., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - java: - { - description: The name of the policy set definition to get., - name: policySetDefinitionName, - serializedName: policySetDefinitionName, - } - nullable: false - operation: *id318 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id102 - - &id320 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id318 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id321 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id318 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id319 - - *id320 - - *id321 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id318 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - uri: "{$host}", - } - signatureParameters: - - *id319 - - *id321 - responses: - - language: - default: - { description: OK - Returns information about the policy set definition., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id272 - signatureParameters: - - *id319 - - *id321 - - &id327 - apiVersions: &id322 - - { version: "2020-09-01" } - exceptions: &id323 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id006 - extensions: &id324 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - List policy set definitions at management group level: - parameters: { api-version: "2020-09-01", managementGroupId: MyManagementGroup } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-09-01/examples/listPolicySetDefinitionsByManagementGroup.json - responses: - "200": - body: - value: - - name: 1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Authorization/policySetDefinitions/1f3afdf9-d0c9-4c3d-847f-89da613e70a8 - properties: - description: Monitor all the available security recommendations - in Azure Security Center. This is the default policy for Azure - Security Center. - displayName: "[Preview]: Enable Monitoring in Azure Security - Center" - metadata: { category: Security Center } - parameters: {} - policyDefinitions: - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/a8bef009-a5c9-4d0f-90d7-6018734e8a16, - policyDefinitionReferenceId: RefId1, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af8051bf-258b-44e2-a2bf-165330459f9d, - policyDefinitionReferenceId: RefId2, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/86b3d65f-7626-441e-b690-81a8b71cff60, - policyDefinitionReferenceId: RefId3, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/655cb504-bcee-4362-bd4c-402e6aa38759, - policyDefinitionReferenceId: RefId4, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/b0f33259-77d7-4c9e-aac6-3aabcfae693c, - policyDefinitionReferenceId: RefId5, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/47a6b606-51aa-4496-8bb7-64b11cf66adc, - policyDefinitionReferenceId: RefId6, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/44452482-524f-4bf4-b852-0bff7cc4a3ed, - policyDefinitionReferenceId: RefId7, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/e1e5fd5d-3e4c-4ce1-8661-7d1873ae6b15, - policyDefinitionReferenceId: RefId8, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/af6cd1bd-1635-48cb-bde7-5b15693900b9, - policyDefinitionReferenceId: RefId9, - } - - { - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/0961003e-5a0a-4549-abde-af6a37f2724d, - policyDefinitionReferenceId: RefId10, - } - policyType: BuiltIn - - name: CostManagement - type: Microsoft.Authorization/policySetDefinitions - id: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policySetDefinitions/CostManagement - properties: - description: Policies to enforce low cost storage SKUs - displayName: Cost Management - metadata: { category: Cost Management } - policyDefinitions: - - parameters: - listOfAllowedSKUs: - value: [Standard_GRS, Standard_LRS] - policyDefinitionId: /providers/Microsoft.Authorization/policyDefinitions/7433c107-6db4-4ad1-b57a-a76dce0154a1 - policyDefinitionReferenceId: Limit_Skus - - parameters: - prefix: { value: DeptA } - suffix: { value: -LC } - policyDefinitionId: /providers/Microsoft.Management/managementgroups/MyManagementGroup/providers/Microsoft.Authorization/policyDefinitions/ResourceNaming - policyDefinitionReferenceId: Resource_Naming - headers: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id326 - $key: listByManagementGroupNext - apiVersions: *id322 - exceptions: *id323 - extensions: *id324 - language: - java: { description: Get the next page of items, name: listByManagementGroupNext } - operationGroup: *id264 - parameters: [] - requests: - - language: &id329 - default: { description: "This operation retrieves a list of all the policy - set definitions in a given management group that match the optional - given $filter. Valid values for $filter are: 'atExactScope()', - 'policyType -eq {value}' or 'category eq '{value}''. If $filter - is not provided, the unfiltered list includes all policy set definitions - associated with the management group, including those that apply - directly or from management groups that contain the given management - group. If $filter=atExactScope() is provided, the returned list - only includes all policy set definitions that at the given management - group. If $filter='policyType -eq {value}' is provided, the returned - list only includes all policy set definitions whose type match the - {value}. Possible policyType values are NotSpecified, BuiltIn and - Custom. If $filter='category -eq {value}' is provided, the returned - list only includes all policy set definitions whose category match - the {value}.", name: ListByManagementGroup, summary: Retrieves all - policy set definitions in management group. } - java: { description: "This operation retrieves a list of all the policy - set definitions in a given management group that match the optional - given $filter. Valid values for $filter are: 'atExactScope()', - 'policyType -eq {value}' or 'category eq '{value}''. If $filter - is not provided, the unfiltered list includes all policy set definitions - associated with the management group, including those that apply - directly or from management groups that contain the given management - group. If $filter=atExactScope() is provided, the returned list - only includes all policy set definitions that at the given management - group. If $filter='policyType -eq {value}' is provided, the returned - list only includes all policy set definitions whose type match the - {value}. Possible policyType values are NotSpecified, BuiltIn and - Custom. If $filter='category -eq {value}' is provided, the returned - list only includes all policy set definitions whose category match - the {value}.", name: listByManagementGroup } - parameters: - - &id328 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id325 { name: nextLink, serializedName: nextLink } - java: *id325 - nullable: false - operation: *id326 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id013 - - &id334 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id327 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id032 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id328 - responses: &id335 - - language: - default: - { description: OK - Returns an array of policy set definitions., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id302 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id329 - operationGroup: *id264 - operationId: PolicySetDefinitions_ListByManagementGroup - parameters: - - *id013 - - &id330 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id327 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: *id101 - - &id331 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - java: - { - description: The ID of the management group., - name: managementGroupId, - serializedName: managementGroupId, - } - nullable: false - operation: *id327 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id085 - - &id332 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: { description: "The filter to apply on the operation. Valid values - for $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType values - are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq - {value}' is provided, the returned list only includes all policy set - definitions whose category match the {value}.", name: filter, serializedName: $filter } - java: { description: "The filter to apply on the operation. Valid values for - $filter are: 'atExactScope()', 'policyType -eq {value}' or 'category - eq '{value}''. If $filter is not provided, no filtering is performed. - If $filter=atExactScope() is provided, the returned list only includes - all policy set definitions that at the given scope. If $filter='policyType - -eq {value}' is provided, the returned list only includes all policy - set definitions whose type match the {value}. Possible policyType values - are NotSpecified, BuiltIn, Custom, and Static. If $filter='category -eq - {value}' is provided, the returned list only includes all policy set - definitions whose category match the {value}.", name: filter, serializedName: $filter } - nullable: false - operation: *id327 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id102 - - &id333 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Maximum number of records to return. When the $top - filter is not provided, it will return 500 records.", name: top, serializedName: $top } - java: { description: "Maximum number of records to return. When the $top filter - is not provided, it will return 500 records.", name: top, serializedName: $top } - nullable: false - operation: *id327 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id146 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id013 - - *id330 - - *id331 - - *id332 - - *id333 - - *id334 - protocol: - http: - { - explode: false, - method: get, - path: "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - uri: "{$host}", - } - signatureParameters: - - *id331 - - *id332 - - *id333 - responses: *id335 - signatureParameters: - - *id331 - - *id332 - - *id333 - - *id286 - - *id299 - - *id326 - protocol: {} - - *id007 -protocol: - http: { explode: false } -schemas: - ands: [] - arrays: - - *id336 - - *id337 - - *id338 - - *id339 - - *id340 - - *id341 - - *id342 - - *id343 - - *id344 - - *id345 - - *id346 - - *id347 - - *id348 - - *id349 - - *id350 - - *id351 - - *id352 - - *id353 - - *id354 - - *id355 - - *id356 - - *id357 - - *id358 - - *id359 - binaries: [] - booleans: - - *id360 - - *id361 - - *id362 - byteArrays: [] - chars: [] - choices: - - *id363 - - *id364 - - *id365 - - *id268 - - *id366 - - *id367 - constants: - - *id101 - - *id032 - - *id028 - credentials: [] - dateTimes: - - *id368 - - *id369 - - *id370 - dates: [] - dictionaries: - - *id270 - - *id198 - - *id269 - durations: [] - flags: [] - groups: [] - numbers: - - *id146 - objects: - - *id099 - - *id371 - - *id372 - - *id373 - - *id374 - - *id090 - - *id091 - - *id375 - - *id376 - - *id377 - - *id006 - - *id378 - - *id116 - - *id379 - - *id380 - - *id381 - - *id382 - - *id143 - - *id200 - - *id383 - - *id384 - - *id385 - - *id243 - - *id272 - - *id386 - - *id387 - - *id388 - - *id302 - - *id037 - - *id389 - - *id390 - - *id050 - odataQueries: [] - ors: [] - parameterGroups: [] - sealedChoices: - - *id391 - - *id392 - - *id393 - streams: [] - strings: - - *id017 - - *id102 - - *id394 - - *id395 - - *id396 - - *id397 - - *id398 - - *id399 - - *id400 - - *id401 - - *id402 - - *id403 - - *id404 - - *id405 - - *id406 - - *id407 - - *id408 - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The ID of the data policy manifest., name: DataPolicyManifestId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The name of the data policy manifest (it's the same as - the Policy Mode)., name: DataPolicyManifestName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The type of the resource (Microsoft.Authorization/dataPolicyManifests)., - name: DataPolicyManifestType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id409 - - *id410 - - *id411 - - *id412 - - *id413 - - *id414 - - *id415 - - *id416 - - *id417 - - *id418 - - *id419 - - *id420 - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The ID of the policy assignment., name: PolicyAssignmentId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The type of the policy assignment., name: PolicyAssignmentType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The name of the policy assignment., name: PolicyAssignmentName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id421 - - *id422 - - *id423 - - *id145 - - *id085 - - *id424 - - *id425 - - *id426 - - *id427 - - *id428 - - *id429 - - *id430 - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The ID of the policy definition., name: PolicyDefinitionId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The name of the policy definition., name: PolicyDefinitionName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The type of the resource (Microsoft.Authorization/policyDefinitions)., - name: PolicyDefinitionType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id431 - - *id432 - - *id433 - - *id434 - - *id435 - - *id436 - - *id437 - - *id438 - - *id439 - - *id440 - - *id441 - - apiVersions: - - { version: "2020-09-01" } - language: - default: { description: The ID of the policy set definition., name: PolicySetDefinitionId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: - { description: The name of the policy set definition., name: PolicySetDefinitionName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: "2020-09-01" } - language: - default: - { - description: The type of the resource (Microsoft.Authorization/policySetDefinitions)., - name: PolicySetDefinitionType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id442 - - *id027 - - *id443 - - *id444 - - *id445 - - *id446 - - *id447 - - *id448 - - apiVersions: - - { version: 2020-07-01-preview } - language: - default: { description: The ID of the policy exemption., name: PolicyExemptionId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: 2020-07-01-preview } - language: - default: { description: The name of the policy exemption., name: PolicyExemptionName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - apiVersions: - - { version: 2020-07-01-preview } - language: - default: - { - description: The type of the resource (Microsoft.Authorization/policyExemptions)., - name: PolicyExemptionType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id449 - - *id075 - unixtimes: [] - unknowns: [] - uris: [] - uuids: [] - xors: [] -security: - authenticationRequired: true - schemes: - - scopes: !!set { "https://management.azure.com/.default": null } - type: OAUTH2 diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-signalr.yaml b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-signalr.yaml deleted file mode 100644 index 87c89a6631..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-signalr.yaml +++ /dev/null @@ -1,15042 +0,0 @@ -!!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel &id002 -apiVersions: [] -clients: [] -globalParameters: - - &id032 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattened: false - implementation: CLIENT - language: - default: { description: Gets subscription Id which uniquely identify the Microsoft - Azure subscription. The subscription ID forms part of the URI for every service - call., name: SubscriptionId, serializedName: subscriptionId } - java: { description: Gets subscription Id which uniquely identify the Microsoft - Azure subscription. The subscription ID forms part of the URI for every service - call., name: subscriptionId, serializedName: subscriptionId } - nullable: false - operation: &id010 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id003 - apiVersions: - - { version: "2.0" } - flattenedSchema: false - language: - default: { description: Common error response for all Azure Resource Manager - APIs to return error details for failed operations. (This also follows - the OData error response format.)., name: ErrorResponse, namespace: "", summary: Error response } - java: { description: Common error response for all Azure Resource Manager - APIs to return error details for failed operations. (This also follows - the OData error response format.)., name: ManagementError } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error object., name: error } - java: { description: The error object., name: error } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id001 - apiVersions: - - { version: "2.0" } - flattenedSchema: false - language: - default: { description: The error detail., name: ErrorDetail, namespace: "" } - java: { description: The error detail., name: ManagementError } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error code., name: code } - java: { description: The error code., name: code } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id349 - apiVersions: - - { version: "2.0" } - language: - default: { description: The error code., name: ErrorDetailCode } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: code - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error message., name: message } - java: { description: The error message., name: message } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id350 - apiVersions: - - { version: "2.0" } - language: - default: { description: The error message., name: ErrorDetailMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The error target., name: target } - java: { description: The error target., name: target } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id351 - apiVersions: - - { version: "2.0" } - language: - default: { description: The error target., name: ErrorDetailTarget } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: target - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The error details., name: details } - java: { description: The error details., name: details } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id226 - apiVersions: - - { version: "2.0" } - elementType: *id001 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: The error details., name: ErrorDetailDetails } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: details - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The error additional info., name: additionalInfo } - java: { description: The error additional info., name: additionalInfo } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id227 - apiVersions: - - { version: "2.0" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema - apiVersions: - - { version: "2.0" } - flattenedSchema: false - language: - default: { description: The resource management error additional - info., name: ErrorAdditionalInfo, namespace: "" } - java: - { - description: The resource management error additional info., - name: ErrorAdditionalInfo, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The additional info type., name: type } - java: { description: The additional info type., name: type } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id352 - apiVersions: - - { version: "2.0" } - language: - default: - { - description: The additional info type., - name: ErrorAdditionalInfoType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The additional info., name: info } - java: { description: The additional info., name: info } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.AnySchema - apiVersions: [] - language: - default: { description: Any object, name: AnyObject } - protocol: {} - type: ANY_OBJECT - serializedName: info - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The error additional info., - name: ErrorDetailAdditionalInfo, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: additionalInfo - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - serializedName: error - protocol: {} - stronglyTypedHeader: false - summary: Error response - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRSharedPrivateLinkResources_Delete: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - sharedPrivateLinkResourceName: upstream, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Delete.json - responses: - "200": {} - "202": - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - "204": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: location } - xmsSkipUrlEncoding: false - language: - default: { description: Delete the specified shared private link resource, name: Delete } - java: { description: Delete the specified shared private link resource, name: delete } - operationGroup: &id007 - $key: SignalRSharedPrivateLinkResources - codeModel: *id002 - language: - default: { description: "", name: SignalRSharedPrivateLinkResources } - java: { description: "", name: SignalRSharedPrivateLinkResources } - operations: - - &id011 - apiVersions: &id004 - - { version: "2023-02-01" } - exceptions: &id005 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id006 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRSharedPrivateLinkResources_List: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_List.json - responses: - "200": - body: - value: - - name: upstream - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/upstream - properties: - { - groupId: sites, - privateLinkResourceId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp, - provisioningState: Succeeded, - requestMessage: Please approve, - status: Approved, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id009 - $key: listNext - apiVersions: *id004 - exceptions: *id005 - extensions: *id006 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id007 - parameters: [] - requests: - - language: &id030 - default: { description: List shared private link resources, name: List } - java: { description: List shared private link resources, name: list } - parameters: - - &id013 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id008 { name: nextLink, serializedName: nextLink } - java: *id008 - nullable: false - operation: *id009 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - &id031 - apiVersions: [] - clientDefaultValue: https://management.azure.com - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: CLIENT - language: - default: - { - description: server parameter, - name: endpoint, - serializedName: $host, - } - java: - { - description: server parameter, - name: endpoint, - serializedName: $host, - } - nullable: false - operation: *id010 - origin: modelerfour:synthesized/host - protocol: - http: { explode: false, in: URI } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id012 - apiVersions: [] - language: - default: { description: simple string, name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - &id037 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id011 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id043 - apiVersions: [] - language: - default: { description: "Accept: application/json", name: Accept } - protocol: {} - type: CONSTANT - value: { value: application/json } - valueType: *id012 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id013 - responses: &id038 - - language: - default: { description: Success. The response describes a list of - shared private link resources., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id326 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: A list of shared private link resources, - name: SharedPrivateLinkResourceList, - namespace: "", - } - java: - { - description: A list of shared private link resources, - name: SharedPrivateLinkResourceList, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: The list of the shared private link resources, - name: value, - } - java: - { - description: The list of the shared private link resources, - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id248 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id016 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: Describes a Shared Private Link Resource, - name: SharedPrivateLinkResource, - namespace: "", - } - java: - { - description: Describes a Shared Private Link Resource, - name: SharedPrivateLinkResource, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id014 - apiVersions: - - { version: "2023-02-01" } - children: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id015 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: A private endpoint connection - to an azure resource, name: PrivateEndpointConnection, namespace: "" } - java: { description: A private endpoint connection - to an azure resource, name: PrivateEndpointConnection } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id014 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id017 - apiVersions: - - { version: "2023-02-01" } - children: - all: - - *id015 - - *id016 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id074 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: A class represent - a resource., name: SignalRResource, namespace: "" } - java: { description: A class represent a - resource., name: SignalRResource } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id018 - apiVersions: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - java: { name: Resource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: - the fully qualified - resource ID for the resource, - name: id, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the name of the - resource, name: name } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the type of the - resource, name: type } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: type - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - java: - { - description: - the geo-location - where the resource live, - name: location, - } - nullable: false - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: location - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the tags of the - resource, name: tags } - nullable: false - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: tags - stronglyTypedHeader: false - - *id017 - immediate: - - *id018 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The billing information - of the resource., - name: sku, - } - java: - { - description: - The billing information - of the resource., - name: sku, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id118 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: - The billing information - of the resource., - name: ResourceSku, - namespace: "", - } - java: - { - description: - The billing information - of the resource., - name: ResourceSku, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "The name of the SKU.\ - \ Required.\r\n\r\nAllowed values:\ - \ Standard_S1, Free_F1, Premium_P1" - name: name - java: - description: - "The name of the SKU.\ - \ Required.\r\n\r\nAllowed values:\ - \ Standard_S1, Free_F1, Premium_P1" - name: name - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id362 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: - "The name of the\ - \ SKU. Required.\r\n\r\nAllowed\ - \ values: Standard_S1, Free_F1,\ - \ Premium_P1" - name: ResourceSkuName - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Optional tier of this\ - \ particular SKU. 'Standard' or\ - \ 'Free'. \r\n\r\n`Basic` is deprecated,\ - \ use `Standard` instead." - name: tier - java: - description: - "Optional tier of this\ - \ particular SKU. 'Standard' or\ - \ 'Free'. \r\n\r\n`Basic` is deprecated,\ - \ use `Standard` instead." - name: tier - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id257 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: FREE, - } - value: Free - - language: - default: - { - description: "", - name: BASIC, - } - value: Basic - - language: - default: - { - description: "", - name: STANDARD, - } - value: Standard - - language: - default: - { - description: "", - name: PREMIUM, - } - value: Premium - language: - default: - description: - "Optional tier of\ - \ this particular SKU. 'Standard'\ - \ or 'Free'. \r\n\r\n`Basic`\ - \ is deprecated, use `Standard`\ - \ instead." - name: SignalRSkuTier - java: - description: - "Optional tier of\ - \ this particular SKU. 'Standard'\ - \ or 'Free'. \r\n\r\n`Basic`\ - \ is deprecated, use `Standard`\ - \ instead." - name: SignalRSkuTier - protocol: {} - type: CHOICE - serializedName: tier - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Not used. Retained - for future use., - name: size, - } - java: - { - description: - Not used. Retained - for future use., - name: size, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id363 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Not used. - Retained for future use., name: ResourceSkuSize } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: size - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Not used. Retained - for future use., - name: family, - } - java: - { - description: - Not used. Retained - for future use., - name: family, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id364 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Not used. - Retained for future use., name: ResourceSkuFamily } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: family - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Optional, integer.\ - \ The unit count of the resource.\ - \ 1 by default.\r\n\r\nIf present,\ - \ following values are allowed:\r\ - \n Free: 1;\r\n Standard:\ - \ 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;\r\ - \n Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;" - name: capacity - java: - description: - "Optional, integer.\ - \ The unit count of the resource.\ - \ 1 by default.\r\n\r\nIf present,\ - \ following values are allowed:\r\ - \n Free: 1;\r\n Standard:\ - \ 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;\r\ - \n Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;" - name: capacity - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id274 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - description: - "Optional, integer.\ - \ The unit count of the resource.\ - \ 1 by default.\r\n\r\nIf present,\ - \ following values are allowed:\r\ - \n Free: 1;\r\n Standard:\ - \ 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;\r\ - \n Premium: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100;" - name: ResourceSkuCapacity - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: capacity - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: sku - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - A class that describes - the properties of the resource, - name: properties, - } - java: - { - description: - A class that describes - the properties of the resource, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id295 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: true - language: - default: { description: A class that - describes the properties of the - resource, name: SignalRProperties, namespace: "" } - java: - { - description: - A class that describes - the properties of the resource, - name: SignalRProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Provisioning - state of the resource., name: provisioningState } - java: - { - description: - Provisioning state - of the resource., - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id024 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: UNKNOWN, - } - value: Unknown - - language: - default: - { - description: "", - name: SUCCEEDED, - } - value: Succeeded - - language: - default: - { - description: "", - name: FAILED, - } - value: Failed - - language: - default: - { - description: "", - name: CANCELED, - } - value: Canceled - - language: - default: - { - description: "", - name: RUNNING, - } - value: Running - - language: - default: - { - description: "", - name: CREATING, - } - value: Creating - - language: - default: - { - description: "", - name: UPDATING, - } - value: Updating - - language: - default: - { - description: "", - name: DELETING, - } - value: Deleting - - language: - default: - { - description: "", - name: MOVING, - } - value: Moving - language: - default: - { description: Provisioning - state of the resource., name: ProvisioningState } - java: - { description: Provisioning - state of the resource., name: ProvisioningState } - protocol: {} - type: CHOICE - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The publicly - accessible IP of the resource., name: externalIp } - java: - { - description: - The publicly accessible - IP of the resource., - name: externalIp, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id365 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The publicly - accessible IP of the resource., name: SignalRPropertiesExternalIp } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: externalIP - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: FQDN of the - service instance., name: hostname } - java: - { - description: - FQDN of the service - instance., - name: hostname, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id366 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: FQDN of the - service instance., name: SignalRPropertiesHostName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: hostName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The publicly - accessible port of the resource - which is designed for browser/client - side usage., name: publicPort } - java: - { - description: - The publicly accessible - port of the resource which is - designed for browser/client side - usage., - name: publicPort, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id275 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: The publicly - accessible port of the resource - which is designed for browser/client - side usage., name: SignalRPropertiesPublicPort } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: publicPort - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The publicly - accessible port of the resource - which is designed for customer - server side usage., name: serverPort } - java: - { - description: - The publicly accessible - port of the resource which is - designed for customer server side - usage., - name: serverPort, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id276 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: The publicly - accessible port of the resource - which is designed for customer - server side usage., name: SignalRPropertiesServerPort } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: serverPort - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Version of - the resource. Probably you need - the same or higher version of - client SDKs., name: version } - java: - { description: Version of the - resource. Probably you need the - same or higher version of client - SDKs., name: version } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id367 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Version of - the resource. Probably you need - the same or higher version of - client SDKs., name: SignalRPropertiesVersion } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: version - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - Private endpoint - connections to the resource., - name: privateEndpointConnections, - } - java: - { - description: - Private endpoint - connections to the resource., - name: privateEndpointConnections, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id230 - apiVersions: - - { version: "2023-02-01" } - elementType: *id015 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: - Private endpoint - connections to the resource., - name: SignalRPropertiesPrivateEndpointConnections, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: privateEndpointConnections - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The list of - shared private link resources., name: sharedPrivateLinkResources } - java: - { - description: - The list of shared - private link resources., - name: sharedPrivateLinkResources, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id231 - apiVersions: - - { version: "2023-02-01" } - elementType: *id016 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: The list - of shared private link resources., name: SignalRPropertiesSharedPrivateLinkResources } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: sharedPrivateLinkResources - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: TLS settings - for the resource, name: tls } - java: - { - description: - TLS settings for - the resource, - name: tls, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id300 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: TLS settings - for the resource, name: SignalRTlsSettings, namespace: "" } - java: - { description: TLS settings - for the resource, name: SignalRTlsSettings } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Request - client certificate during - TLS handshake if enabled, name: clientCertEnabled } - java: - { - description: - Request client - certificate during TLS handshake - if enabled, - name: clientCertEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id254 - apiVersions: [] - defaultValue: true - language: - default: - { description: Request - client certificate during - TLS handshake if enabled, name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: clientCertEnabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: tls - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Deprecated., - name: hostnamePrefix, - } - java: - { - description: Deprecated., - name: hostnamePrefix, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id380 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: Deprecated., - name: SignalRPropertiesHostNamePrefix, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: hostNamePrefix - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - description: - "List of the featureFlags.\r\ - \n\r\nFeatureFlags that are not\ - \ included in the parameters for\ - \ the update operation will not\ - \ be modified.\r\nAnd the response\ - \ will only include featureFlags\ - \ that are explicitly set. \r\n\ - When a featureFlag is not explicitly\ - \ set, its globally default value\ - \ will be used\r\nBut keep in\ - \ mind, the default value doesn't\ - \ mean \"false\". It varies in\ - \ terms of different FeatureFlags." - name: features - java: - description: - "List of the featureFlags.\r\ - \n\r\nFeatureFlags that are not\ - \ included in the parameters for\ - \ the update operation will not\ - \ be modified.\r\nAnd the response\ - \ will only include featureFlags\ - \ that are explicitly set. \r\n\ - When a featureFlag is not explicitly\ - \ set, its globally default value\ - \ will be used\r\nBut keep in\ - \ mind, the default value doesn't\ - \ mean \"false\". It varies in\ - \ terms of different FeatureFlags." - name: features - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id232 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id301 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: "Feature - of a resource, which controls - the runtime behavior.", name: SignalRFeature, namespace: "" } - java: - { description: "Feature of - a resource, which controls - the runtime behavior.", name: SignalRFeature } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "FeatureFlags\ - \ is the supported features\ - \ of Azure SignalR service.\r\ - \n- ServiceMode: Flag for\ - \ backend server for SignalR\ - \ service. Values allowed:\ - \ \"Default\": have your\ - \ own backend server; \"\ - Serverless\": your application\ - \ doesn't have a backend\ - \ server; \"Classic\": for\ - \ backward compatibility.\ - \ Support both Default and\ - \ Serverless mode but not\ - \ recommended; \"PredefinedOnly\"\ - : for future use.\r\n- EnableConnectivityLogs:\ - \ \"true\"/\"false\", to\ - \ enable/disable the connectivity\ - \ log category respectively.\r\ - \n- EnableMessagingLogs:\ - \ \"true\"/\"false\", to\ - \ enable/disable the connectivity\ - \ log category respectively.\r\ - \n- EnableLiveTrace: Live\ - \ Trace allows you to know\ - \ what's happening inside\ - \ Azure SignalR service,\ - \ it will give you live\ - \ traces in real time, it\ - \ will be helpful when you\ - \ developing your own Azure\ - \ SignalR based web application\ - \ or self-troubleshooting\ - \ some issues. Please note\ - \ that live traces are counted\ - \ as outbound messages that\ - \ will be charged. Values\ - \ allowed: \"true\"/\"false\"\ - , to enable/disable live\ - \ trace feature." - name: flag - java: - description: - "FeatureFlags\ - \ is the supported features\ - \ of Azure SignalR service.\r\ - \n- ServiceMode: Flag for\ - \ backend server for SignalR\ - \ service. Values allowed:\ - \ \"Default\": have your\ - \ own backend server; \"\ - Serverless\": your application\ - \ doesn't have a backend\ - \ server; \"Classic\": for\ - \ backward compatibility.\ - \ Support both Default and\ - \ Serverless mode but not\ - \ recommended; \"PredefinedOnly\"\ - : for future use.\r\n- EnableConnectivityLogs:\ - \ \"true\"/\"false\", to\ - \ enable/disable the connectivity\ - \ log category respectively.\r\ - \n- EnableMessagingLogs:\ - \ \"true\"/\"false\", to\ - \ enable/disable the connectivity\ - \ log category respectively.\r\ - \n- EnableLiveTrace: Live\ - \ Trace allows you to know\ - \ what's happening inside\ - \ Azure SignalR service,\ - \ it will give you live\ - \ traces in real time, it\ - \ will be helpful when you\ - \ developing your own Azure\ - \ SignalR based web application\ - \ or self-troubleshooting\ - \ some issues. Please note\ - \ that live traces are counted\ - \ as outbound messages that\ - \ will be charged. Values\ - \ allowed: \"true\"/\"false\"\ - , to enable/disable live\ - \ trace feature." - name: flag - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id260 - apiVersions: - - { - version: "2023-02-01", - } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: SERVICE_MODE, - } - value: ServiceMode - - language: - default: - { - description: "", - name: ENABLE_CONNECTIVITY_LOGS, - } - value: EnableConnectivityLogs - - language: - default: - { - description: "", - name: ENABLE_MESSAGING_LOGS, - } - value: EnableMessagingLogs - - language: - default: - { - description: "", - name: ENABLE_LIVE_TRACE, - } - value: EnableLiveTrace - language: - default: - description: - "FeatureFlags\ - \ is the supported features\ - \ of Azure SignalR service.\r\ - \n- ServiceMode: Flag\ - \ for backend server for\ - \ SignalR service. Values\ - \ allowed: \"Default\"\ - : have your own backend\ - \ server; \"Serverless\"\ - : your application doesn't\ - \ have a backend server;\ - \ \"Classic\": for backward\ - \ compatibility. Support\ - \ both Default and Serverless\ - \ mode but not recommended;\ - \ \"PredefinedOnly\":\ - \ for future use.\r\n\ - - EnableConnectivityLogs:\ - \ \"true\"/\"false\",\ - \ to enable/disable the\ - \ connectivity log category\ - \ respectively.\r\n- EnableMessagingLogs:\ - \ \"true\"/\"false\",\ - \ to enable/disable the\ - \ connectivity log category\ - \ respectively.\r\n- EnableLiveTrace:\ - \ Live Trace allows you\ - \ to know what's happening\ - \ inside Azure SignalR\ - \ service, it will give\ - \ you live traces in real\ - \ time, it will be helpful\ - \ when you developing\ - \ your own Azure SignalR\ - \ based web application\ - \ or self-troubleshooting\ - \ some issues. Please\ - \ note that live traces\ - \ are counted as outbound\ - \ messages that will be\ - \ charged. Values allowed:\ - \ \"true\"/\"false\",\ - \ to enable/disable live\ - \ trace feature." - name: FeatureFlags - java: - description: - "FeatureFlags\ - \ is the supported features\ - \ of Azure SignalR service.\r\ - \n- ServiceMode: Flag\ - \ for backend server for\ - \ SignalR service. Values\ - \ allowed: \"Default\"\ - : have your own backend\ - \ server; \"Serverless\"\ - : your application doesn't\ - \ have a backend server;\ - \ \"Classic\": for backward\ - \ compatibility. Support\ - \ both Default and Serverless\ - \ mode but not recommended;\ - \ \"PredefinedOnly\":\ - \ for future use.\r\n\ - - EnableConnectivityLogs:\ - \ \"true\"/\"false\",\ - \ to enable/disable the\ - \ connectivity log category\ - \ respectively.\r\n- EnableMessagingLogs:\ - \ \"true\"/\"false\",\ - \ to enable/disable the\ - \ connectivity log category\ - \ respectively.\r\n- EnableLiveTrace:\ - \ Live Trace allows you\ - \ to know what's happening\ - \ inside Azure SignalR\ - \ service, it will give\ - \ you live traces in real\ - \ time, it will be helpful\ - \ when you developing\ - \ your own Azure SignalR\ - \ based web application\ - \ or self-troubleshooting\ - \ some issues. Please\ - \ note that live traces\ - \ are counted as outbound\ - \ messages that will be\ - \ charged. Values allowed:\ - \ \"true\"/\"false\",\ - \ to enable/disable live\ - \ trace feature." - name: FeatureFlags - protocol: {} - type: CHOICE - serializedName: flag - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Value - of the feature flag. See - Azure SignalR service document - https://docs.microsoft.com/azure/azure-signalr/ - for allowed values.", name: value } - java: - { - description: - "Value of - the feature flag. See Azure - SignalR service document - https://docs.microsoft.com/azure/azure-signalr/ - for allowed values.", - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id381 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: - "Value - of the feature flag. See - Azure SignalR service - document https://docs.microsoft.com/azure/azure-signalr/ - for allowed values.", - name: SignalRFeatureValue, - } - maxLength: 128.0 - minLength: 1.0 - protocol: {} - type: STRING - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Optional - properties related to this - feature., - name: properties, - } - java: - { - description: - Optional - properties related to this - feature., - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id270 - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id033 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: "", - name: String, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { - description: - Optional - properties related to - this feature., - name: SignalRFeatureProperties, - } - java: - { - description: - Optional - properties related to - this feature., - name: SignalRFeatureProperties, - } - protocol: {} - type: DICTIONARY - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - description: - "List of the featureFlags.\r\ - \n\r\nFeatureFlags that are\ - \ not included in the parameters\ - \ for the update operation will\ - \ not be modified.\r\nAnd the\ - \ response will only include\ - \ featureFlags that are explicitly\ - \ set. \r\nWhen a featureFlag\ - \ is not explicitly set, its\ - \ globally default value will\ - \ be used\r\nBut keep in mind,\ - \ the default value doesn't\ - \ mean \"false\". It varies\ - \ in terms of different FeatureFlags." - name: SignalRPropertiesFeatures - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: features - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Live trace - configuration of a Microsoft.SignalRService - resource., name: liveTraceConfiguration } - java: - { - description: - Live trace configuration - of a Microsoft.SignalRService - resource., - name: liveTraceConfiguration, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id302 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Live trace - configuration of a Microsoft.SignalRService - resource., name: LiveTraceConfiguration, namespace: "" } - java: - { - description: - Live trace configuration - of a Microsoft.SignalRService - resource., - name: LiveTraceConfiguration, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Indicates whether\ - \ or not enable live trace.\r\ - \nWhen it's set to true, live\ - \ trace client can connect\ - \ to the service.\r\nOtherwise,\ - \ live trace client can't\ - \ connect to the service,\ - \ so that you are unable to\ - \ receive any log, no matter\ - \ what you configure in \"\ - categories\".\r\nAvailable\ - \ values: true, false.\r\n\ - Case insensitive." - name: enabled - java: - description: - "Indicates whether\ - \ or not enable live trace.\r\ - \nWhen it's set to true, live\ - \ trace client can connect\ - \ to the service.\r\nOtherwise,\ - \ live trace client can't\ - \ connect to the service,\ - \ so that you are unable to\ - \ receive any log, no matter\ - \ what you configure in \"\ - categories\".\r\nAvailable\ - \ values: true, false.\r\n\ - Case insensitive." - name: enabled - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id382 - apiVersions: - - { - version: "2023-02-01", - } - defaultValue: "false" - language: - default: - description: - "Indicates whether\ - \ or not enable live trace.\r\ - \nWhen it's set to true,\ - \ live trace client can\ - \ connect to the service.\r\ - \nOtherwise, live trace\ - \ client can't connect to\ - \ the service, so that you\ - \ are unable to receive\ - \ any log, no matter what\ - \ you configure in \"categories\"\ - .\r\nAvailable values: true,\ - \ false.\r\nCase insensitive." - name: LiveTraceConfigurationEnabled - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: enabled - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Gets or - sets the list of category - configurations., name: categories } - java: - { - description: - Gets or sets - the list of category configurations., - name: categories, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id233 - apiVersions: - - { - version: "2023-02-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id303 - apiVersions: - - { - version: "2023-02-01", - } - flattenedSchema: false - language: - default: - { description: Live - trace category configuration - of a Microsoft.SignalRService - resource., name: LiveTraceCategory, namespace: "" } - java: - { - description: - Live trace - category configuration - of a Microsoft.SignalRService - resource., - name: LiveTraceCategory, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Gets or\ - \ sets the live trace\ - \ category's name.\r\ - \nAvailable values:\ - \ ConnectivityLogs,\ - \ MessagingLogs.\r\n\ - Case insensitive." - name: name - java: - description: - "Gets or\ - \ sets the live trace\ - \ category's name.\r\ - \nAvailable values:\ - \ ConnectivityLogs,\ - \ MessagingLogs.\r\n\ - Case insensitive." - name: name - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id383 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Gets or\ - \ sets the live trace\ - \ category's name.\r\ - \nAvailable values:\ - \ ConnectivityLogs,\ - \ MessagingLogs.\r\ - \nCase insensitive." - name: LiveTraceCategoryName - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Indicates\ - \ whether or the live\ - \ trace category is\ - \ enabled.\r\nAvailable\ - \ values: true, false.\r\ - \nCase insensitive." - name: enabled - java: - description: - "Indicates\ - \ whether or the live\ - \ trace category is\ - \ enabled.\r\nAvailable\ - \ values: true, false.\r\ - \nCase insensitive." - name: enabled - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id384 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Indicates\ - \ whether or the live\ - \ trace category is\ - \ enabled.\r\nAvailable\ - \ values: true, false.\r\ - \nCase insensitive." - name: LiveTraceCategoryEnabled - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: enabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Gets - or sets the list of category - configurations., name: LiveTraceConfigurationCategories } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: categories - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: liveTraceConfiguration - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Resource log - configuration of a Microsoft.SignalRService - resource., name: resourceLogConfiguration } - java: - { - description: - Resource log configuration - of a Microsoft.SignalRService - resource., - name: resourceLogConfiguration, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id304 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Resource - log configuration of a Microsoft.SignalRService - resource., name: ResourceLogConfiguration, namespace: "" } - java: - { description: Resource log - configuration of a Microsoft.SignalRService - resource., name: ResourceLogConfiguration } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Gets or - sets the list of category - configurations., name: categories } - java: - { - description: - Gets or sets - the list of category configurations., - name: categories, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id234 - apiVersions: - - { - version: "2023-02-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id305 - apiVersions: - - { - version: "2023-02-01", - } - flattenedSchema: false - language: - default: - { - description: - Resource - log category configuration - of a Microsoft.SignalRService - resource., - name: ResourceLogCategory, - namespace: "", - } - java: - { - description: - Resource - log category configuration - of a Microsoft.SignalRService - resource., - name: ResourceLogCategory, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Gets or\ - \ sets the resource\ - \ log category's name.\r\ - \nAvailable values:\ - \ ConnectivityLogs,\ - \ MessagingLogs.\r\n\ - Case insensitive." - name: name - java: - description: - "Gets or\ - \ sets the resource\ - \ log category's name.\r\ - \nAvailable values:\ - \ ConnectivityLogs,\ - \ MessagingLogs.\r\n\ - Case insensitive." - name: name - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id385 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Gets or\ - \ sets the resource\ - \ log category's name.\r\ - \nAvailable values:\ - \ ConnectivityLogs,\ - \ MessagingLogs.\r\ - \nCase insensitive." - name: ResourceLogCategoryName - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Indicates\ - \ whether or the resource\ - \ log category is enabled.\r\ - \nAvailable values:\ - \ true, false.\r\nCase\ - \ insensitive." - name: enabled - java: - description: - "Indicates\ - \ whether or the resource\ - \ log category is enabled.\r\ - \nAvailable values:\ - \ true, false.\r\nCase\ - \ insensitive." - name: enabled - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id386 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Indicates\ - \ whether or the resource\ - \ log category is\ - \ enabled.\r\nAvailable\ - \ values: true, false.\r\ - \nCase insensitive." - name: ResourceLogCategoryEnabled - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: enabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Gets - or sets the list of category - configurations., name: ResourceLogConfigurationCategories } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: categories - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: resourceLogConfiguration - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Cross-Origin - Resource Sharing (CORS) settings., name: cors } - java: - { - description: - Cross-Origin Resource - Sharing (CORS) settings., - name: cors, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id306 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Cross-Origin - Resource Sharing (CORS) settings., name: SignalRCorsSettings, namespace: "" } - java: - { description: Cross-Origin - Resource Sharing (CORS) settings., name: SignalRCorsSettings } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: 'Gets or - sets the list of origins that - should be allowed to make - cross-origin calls (for example: - http://example.com:12345). - Use "*" to allow all. If omitted, - allow all by default.', name: allowedOrigins } - java: - { - description: - 'Gets or sets - the list of origins that should - be allowed to make cross-origin - calls (for example: http://example.com:12345). - Use "*" to allow all. If omitted, - allow all by default.', - name: allowedOrigins, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id235 - apiVersions: - - { - version: "2023-02-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id387 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: "", - name: SignalRCorsSettingsAllowedOriginsItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: 'Gets - or sets the list of origins - that should be allowed to - make cross-origin calls - (for example: http://example.com:12345). - Use "*" to allow all. If - omitted, allow all by default.', name: SignalRCorsSettingsAllowedOrigins } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: allowedOrigins - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: cors - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Serverless - settings., name: serverless } - java: - { - description: Serverless settings., - name: serverless, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id307 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Serverless - settings., name: ServerlessSettings, namespace: "" } - java: - { - description: Serverless settings., - name: ServerlessSettings, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Gets or sets Client\ - \ Connection Timeout. Optional\ - \ to be set.\r\nValue in seconds.\r\ - \nDefault value is 30 seconds.\r\ - \nCustomer should set the\ - \ timeout to a shorter period\ - \ if messages are expected\ - \ to be sent in shorter intervals,\r\ - \nand want the client to disconnect\ - \ more quickly after the last\ - \ message is sent.\r\nYou\ - \ can set the timeout to a\ - \ longer period if messages\ - \ are expected to be sent\ - \ in longer intervals,\r\n\ - and they want to keep the\ - \ same client connection alive\ - \ during this session.\r\n\ - The service considers the\ - \ client disconnected if it\ - \ hasn't received a message\ - \ (including keep-alive) in\ - \ this interval." - name: connectionTimeoutInSeconds - java: - description: - "Gets or sets Client\ - \ Connection Timeout. Optional\ - \ to be set.\r\nValue in seconds.\r\ - \nDefault value is 30 seconds.\r\ - \nCustomer should set the\ - \ timeout to a shorter period\ - \ if messages are expected\ - \ to be sent in shorter intervals,\r\ - \nand want the client to disconnect\ - \ more quickly after the last\ - \ message is sent.\r\nYou\ - \ can set the timeout to a\ - \ longer period if messages\ - \ are expected to be sent\ - \ in longer intervals,\r\n\ - and they want to keep the\ - \ same client connection alive\ - \ during this session.\r\n\ - The service considers the\ - \ client disconnected if it\ - \ hasn't received a message\ - \ (including keep-alive) in\ - \ this interval." - name: connectionTimeoutInSeconds - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id277 - apiVersions: - - { - version: "2023-02-01", - } - defaultValue: 30 - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - description: - "Gets or sets\ - \ Client Connection Timeout.\ - \ Optional to be set.\r\n\ - Value in seconds.\r\nDefault\ - \ value is 30 seconds.\r\ - \nCustomer should set the\ - \ timeout to a shorter period\ - \ if messages are expected\ - \ to be sent in shorter\ - \ intervals,\r\nand want\ - \ the client to disconnect\ - \ more quickly after the\ - \ last message is sent.\r\ - \nYou can set the timeout\ - \ to a longer period if\ - \ messages are expected\ - \ to be sent in longer intervals,\r\ - \nand they want to keep\ - \ the same client connection\ - \ alive during this session.\r\ - \nThe service considers\ - \ the client disconnected\ - \ if it hasn't received\ - \ a message (including keep-alive)\ - \ in this interval." - name: ServerlessSettingsConnectionTimeoutInSeconds - maximum: 120.0 - minimum: 1.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: connectionTimeoutInSeconds - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: serverless - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The settings - for the Upstream when the service - is in server-less mode., name: upstream } - java: - { - description: - The settings for - the Upstream when the service - is in server-less mode., - name: upstream, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id308 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: The settings - for the Upstream when the service - is in server-less mode., name: ServerlessUpstreamSettings, namespace: "" } - java: - { description: The settings - for the Upstream when the service - is in server-less mode., name: ServerlessUpstreamSettings } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: "Gets or - sets the list of Upstream - URL templates. Order matters, - and the first matching template - takes effects.", name: templates } - java: - { - description: - "Gets or sets - the list of Upstream URL templates. - Order matters, and the first - matching template takes effects.", - name: templates, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id236 - apiVersions: - - { - version: "2023-02-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id309 - apiVersions: - - { - version: "2023-02-01", - } - flattenedSchema: false - language: - default: - description: - "Upstream template\ - \ item settings. It defines\ - \ the Upstream URL of\ - \ the incoming requests.\r\ - \nThe template defines\ - \ the pattern of the event,\ - \ the hub or the category\ - \ of the incoming request\ - \ that matches current\ - \ URL template." - name: UpstreamTemplate - namespace: "" - java: - description: - "Upstream template\ - \ item settings. It defines\ - \ the Upstream URL of\ - \ the incoming requests.\r\ - \nThe template defines\ - \ the pattern of the event,\ - \ the hub or the category\ - \ of the incoming request\ - \ that matches current\ - \ URL template." - name: UpstreamTemplate - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Gets or\ - \ sets the matching\ - \ pattern for hub names.\ - \ If not set, it matches\ - \ any hub.\r\nThere\ - \ are 3 kind of patterns\ - \ supported:\r\n \ - \ 1. \"*\", it to matches\ - \ any hub name.\r\n\ - \ 2. Combine multiple\ - \ hubs with \",\", for\ - \ example \"hub1,hub2\"\ - , it matches \"hub1\"\ - \ and \"hub2\".\r\n\ - \ 3. The single hub\ - \ name, for example,\ - \ \"hub1\", it matches\ - \ \"hub1\"." - name: hubPattern - java: - description: - "Gets or\ - \ sets the matching\ - \ pattern for hub names.\ - \ If not set, it matches\ - \ any hub.\r\nThere\ - \ are 3 kind of patterns\ - \ supported:\r\n \ - \ 1. \"*\", it to matches\ - \ any hub name.\r\n\ - \ 2. Combine multiple\ - \ hubs with \",\", for\ - \ example \"hub1,hub2\"\ - , it matches \"hub1\"\ - \ and \"hub2\".\r\n\ - \ 3. The single hub\ - \ name, for example,\ - \ \"hub1\", it matches\ - \ \"hub1\"." - name: hubPattern - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id388 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Gets or\ - \ sets the matching\ - \ pattern for hub\ - \ names. If not set,\ - \ it matches any hub.\r\ - \nThere are 3 kind\ - \ of patterns supported:\r\ - \n 1. \"*\", it\ - \ to matches any hub\ - \ name.\r\n 2.\ - \ Combine multiple\ - \ hubs with \",\"\ - , for example \"hub1,hub2\"\ - , it matches \"hub1\"\ - \ and \"hub2\".\r\n\ - \ 3. The single\ - \ hub name, for example,\ - \ \"hub1\", it matches\ - \ \"hub1\"." - name: UpstreamTemplateHubPattern - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: hubPattern - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Gets or\ - \ sets the matching\ - \ pattern for event\ - \ names. If not set,\ - \ it matches any event.\r\ - \nThere are 3 kind of\ - \ patterns supported:\r\ - \n 1. \"*\", it to\ - \ matches any event\ - \ name.\r\n 2. Combine\ - \ multiple events with\ - \ \",\", for example\ - \ \"connect,disconnect\"\ - , it matches event \"\ - connect\" and \"disconnect\"\ - .\r\n 3. The single\ - \ event name, for example,\ - \ \"connect\", it matches\ - \ \"connect\"." - name: eventPattern - java: - description: - "Gets or\ - \ sets the matching\ - \ pattern for event\ - \ names. If not set,\ - \ it matches any event.\r\ - \nThere are 3 kind of\ - \ patterns supported:\r\ - \n 1. \"*\", it to\ - \ matches any event\ - \ name.\r\n 2. Combine\ - \ multiple events with\ - \ \",\", for example\ - \ \"connect,disconnect\"\ - , it matches event \"\ - connect\" and \"disconnect\"\ - .\r\n 3. The single\ - \ event name, for example,\ - \ \"connect\", it matches\ - \ \"connect\"." - name: eventPattern - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id389 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Gets or\ - \ sets the matching\ - \ pattern for event\ - \ names. If not set,\ - \ it matches any event.\r\ - \nThere are 3 kind\ - \ of patterns supported:\r\ - \n 1. \"*\", it\ - \ to matches any event\ - \ name.\r\n 2.\ - \ Combine multiple\ - \ events with \",\"\ - , for example \"connect,disconnect\"\ - , it matches event\ - \ \"connect\" and\ - \ \"disconnect\".\r\ - \n 3. The single\ - \ event name, for\ - \ example, \"connect\"\ - , it matches \"connect\"\ - ." - name: UpstreamTemplateEventPattern - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: eventPattern - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Gets or\ - \ sets the matching\ - \ pattern for category\ - \ names. If not set,\ - \ it matches any category.\r\ - \nThere are 3 kind of\ - \ patterns supported:\r\ - \n 1. \"*\", it to\ - \ matches any category\ - \ name.\r\n 2. Combine\ - \ multiple categories\ - \ with \",\", for example\ - \ \"connections,messages\"\ - , it matches category\ - \ \"connections\" and\ - \ \"messages\".\r\n\ - \ 3. The single category\ - \ name, for example,\ - \ \"connections\", it\ - \ matches the category\ - \ \"connections\"." - name: categoryPattern - java: - description: - "Gets or\ - \ sets the matching\ - \ pattern for category\ - \ names. If not set,\ - \ it matches any category.\r\ - \nThere are 3 kind of\ - \ patterns supported:\r\ - \n 1. \"*\", it to\ - \ matches any category\ - \ name.\r\n 2. Combine\ - \ multiple categories\ - \ with \",\", for example\ - \ \"connections,messages\"\ - , it matches category\ - \ \"connections\" and\ - \ \"messages\".\r\n\ - \ 3. The single category\ - \ name, for example,\ - \ \"connections\", it\ - \ matches the category\ - \ \"connections\"." - name: categoryPattern - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id390 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Gets or\ - \ sets the matching\ - \ pattern for category\ - \ names. If not set,\ - \ it matches any category.\r\ - \nThere are 3 kind\ - \ of patterns supported:\r\ - \n 1. \"*\", it\ - \ to matches any category\ - \ name.\r\n 2.\ - \ Combine multiple\ - \ categories with\ - \ \",\", for example\ - \ \"connections,messages\"\ - , it matches category\ - \ \"connections\"\ - \ and \"messages\"\ - .\r\n 3. The single\ - \ category name, for\ - \ example, \"connections\"\ - , it matches the category\ - \ \"connections\"." - name: UpstreamTemplateCategoryPattern - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: categoryPattern - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Gets or\ - \ sets the Upstream\ - \ URL template. You\ - \ can use 3 predefined\ - \ parameters {hub},\ - \ {category} {event}\ - \ inside the template,\ - \ the value of the Upstream\ - \ URL is dynamically\ - \ calculated when the\ - \ client request comes\ - \ in.\r\nFor example,\ - \ if the urlTemplate\ - \ is `http://example.com/{hub}/api/{event}`,\ - \ with a client request\ - \ from hub `chat` connects,\ - \ it will first POST\ - \ to this URL: `http://example.com/chat/api/connect`." - name: urlTemplate - java: - description: - "Gets or\ - \ sets the Upstream\ - \ URL template. You\ - \ can use 3 predefined\ - \ parameters {hub},\ - \ {category} {event}\ - \ inside the template,\ - \ the value of the Upstream\ - \ URL is dynamically\ - \ calculated when the\ - \ client request comes\ - \ in.\r\nFor example,\ - \ if the urlTemplate\ - \ is `http://example.com/{hub}/api/{event}`,\ - \ with a client request\ - \ from hub `chat` connects,\ - \ it will first POST\ - \ to this URL: `http://example.com/chat/api/connect`." - name: urlTemplate - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id391 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "Gets or\ - \ sets the Upstream\ - \ URL template. You\ - \ can use 3 predefined\ - \ parameters {hub},\ - \ {category} {event}\ - \ inside the template,\ - \ the value of the\ - \ Upstream URL is\ - \ dynamically calculated\ - \ when the client\ - \ request comes in.\r\ - \nFor example, if\ - \ the urlTemplate\ - \ is `http://example.com/{hub}/api/{event}`,\ - \ with a client request\ - \ from hub `chat`\ - \ connects, it will\ - \ first POST to this\ - \ URL: `http://example.com/chat/api/connect`." - name: UpstreamTemplateUrlTemplate - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: urlTemplate - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "Upstream - auth settings. If not - set, no auth is used - for upstream messages.", - name: auth, - } - java: - { - description: - "Upstream - auth settings. If not - set, no auth is used - for upstream messages.", - name: auth, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id310 - apiVersions: - - { - version: "2023-02-01", - } - flattenedSchema: false - language: - default: - { - description: - "Upstream - auth settings. If - not set, no auth is - used for upstream - messages.", - name: UpstreamAuthSettings, - namespace: "", - } - java: - { - description: - "Upstream - auth settings. If - not set, no auth is - used for upstream - messages.", - name: UpstreamAuthSettings, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - Upstream - auth type enum., - name: type, - } - java: - { - description: - Upstream - auth type enum., - name: type, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id261 - apiVersions: - - { - version: "2023-02-01", - } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: NONE, - } - value: None - - language: - default: - { - description: "", - name: MANAGED_IDENTITY, - } - value: ManagedIdentity - language: - default: - { - description: - Upstream - auth type enum., - name: UpstreamAuthType, - } - java: - { - description: - Upstream - auth type enum., - name: UpstreamAuthType, - } - protocol: {} - type: CHOICE - serializedName: type - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - Managed - identity settings - for upstream., - name: managedIdentity, - } - java: - { - description: - Managed - identity settings - for upstream., - name: managedIdentity, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id311 - apiVersions: - - { - version: "2023-02-01", - } - flattenedSchema: false - language: - default: - { - description: - Managed - identity settings - for upstream., - name: ManagedIdentitySettings, - namespace: "", - } - java: - { - description: - Managed - identity settings - for upstream., - name: ManagedIdentitySettings, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: - [] - isDiscriminator: false - language: - default: - description: - "The\ - \ Resource indicating\ - \ the App ID\ - \ URI of the\ - \ target resource.\r\ - \nIt also appears\ - \ in the aud\ - \ (audience)\ - \ claim of the\ - \ issued token." - name: resource - java: - description: - "The\ - \ Resource indicating\ - \ the App ID\ - \ URI of the\ - \ target resource.\r\ - \nIt also appears\ - \ in the aud\ - \ (audience)\ - \ claim of the\ - \ issued token." - name: resource - nullable: false - protocol: - {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id392 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - description: - "The\ - \ Resource\ - \ indicating\ - \ the App\ - \ ID URI of\ - \ the target\ - \ resource.\r\ - \nIt also\ - \ appears\ - \ in the aud\ - \ (audience)\ - \ claim of\ - \ the issued\ - \ token." - name: ManagedIdentitySettingsResource - maxLength: 0.0 - minLength: 0.0 - protocol: - {} - type: STRING - serializedName: resource - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: managedIdentity - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: auth - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: "Gets - or sets the list of Upstream - URL templates. Order matters, - and the first matching template - takes effects.", name: ServerlessUpstreamSettingsTemplates } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: templates - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: upstream - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Network ACLs - for the resource, name: networkACLs } - java: - { - description: - Network ACLs for - the resource, - name: networkACLs, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id312 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Network ACLs - for the resource, name: SignalRNetworkACLs, namespace: "" } - java: - { description: Network ACLs - for the resource, name: SignalRNetworkACLs } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Azure Networking - ACL Action., - name: defaultAction, - } - java: - { - description: - Azure Networking - ACL Action., - name: defaultAction, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id262 - apiVersions: - - { - version: "2023-02-01", - } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: ALLOW, - } - value: Allow - - language: - default: - { - description: "", - name: DENY, - } - value: Deny - language: - default: - { description: Azure - Networking ACL Action., name: AclAction } - java: - { - description: - Azure Networking - ACL Action., - name: AclAction, - } - protocol: {} - type: CHOICE - serializedName: defaultAction - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Network - ACL, name: publicNetwork } - java: - { - description: Network ACL, - name: publicNetwork, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id019 - apiVersions: - - { - version: "2023-02-01", - } - children: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id020 - apiVersions: - - { - version: "2023-02-01", - } - flattenedSchema: false - language: - default: - { - description: - ACL - for a private endpoint, - name: PrivateEndpointAcl, - namespace: "", - } - java: - { - description: - ACL - for a private endpoint, - name: PrivateEndpointAcl, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id019 - immediate: - - *id019 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Name - of the private endpoint - connection, - name: name, - } - java: - { - description: - Name - of the private endpoint - connection, - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id393 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: - Name - of the private endpoint - connection, - name: PrivateEndpointAclName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - immediate: - - *id020 - flattenedSchema: false - language: - default: - { description: Network - ACL, name: NetworkAcl, namespace: "" } - java: - { description: Network - ACL, name: NetworkAcl } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - "Allowed - request types. The value - can be one or more of: - ClientConnection, ServerConnection, - RESTAPI.", - name: allow, - } - java: - { - description: - "Allowed - request types. The value - can be one or more of: - ClientConnection, ServerConnection, - RESTAPI.", - name: allow, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id237 - apiVersions: - - { - version: "2023-02-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id021 - apiVersions: - - { - version: "2023-02-01", - } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: CLIENT_CONNECTION, - } - value: ClientConnection - - language: - default: - { - description: "", - name: SERVER_CONNECTION, - } - value: ServerConnection - - language: - default: - { - description: "", - name: RESTAPI, - } - value: RESTAPI - - language: - default: - { - description: "", - name: TRACE, - } - value: Trace - language: - default: - { - description: - The - incoming request type - to the service, - name: SignalRRequestType, - } - java: - { - description: - The - incoming request type - to the service, - name: SignalRRequestType, - } - protocol: {} - type: CHOICE - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: - "Allowed - request types. The value - can be one or more of: - ClientConnection, ServerConnection, - RESTAPI.", - name: NetworkAclAllow, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: allow - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - "Denied - request types. The value - can be one or more of: - ClientConnection, ServerConnection, - RESTAPI.", - name: deny, - } - java: - { - description: - "Denied - request types. The value - can be one or more of: - ClientConnection, ServerConnection, - RESTAPI.", - name: deny, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id238 - apiVersions: - - { - version: "2023-02-01", - } - elementType: *id021 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: - "Denied - request types. The value - can be one or more of: - ClientConnection, ServerConnection, - RESTAPI.", - name: NetworkAclDeny, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: deny - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: publicNetwork - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: ACLs for - requests from private endpoints, name: privateEndpoints } - java: - { - description: - ACLs for requests - from private endpoints, - name: privateEndpoints, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id239 - apiVersions: - - { - version: "2023-02-01", - } - elementType: *id020 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: ACLs - for requests from private - endpoints, name: SignalRNetworkAclsPrivateEndpoints } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: privateEndpoints - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: networkACLs - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Enable or disable\ - \ public network access. Default\ - \ to \"Enabled\".\r\nWhen it's\ - \ Enabled, network ACLs still\ - \ apply.\r\nWhen it's Disabled,\ - \ public network access is always\ - \ disabled no matter what you\ - \ set in network ACLs." - name: publicNetworkAccess - java: - description: - "Enable or disable\ - \ public network access. Default\ - \ to \"Enabled\".\r\nWhen it's\ - \ Enabled, network ACLs still\ - \ apply.\r\nWhen it's Disabled,\ - \ public network access is always\ - \ disabled no matter what you\ - \ set in network ACLs." - name: publicNetworkAccess - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id394 - apiVersions: - - { version: "2023-02-01" } - defaultValue: Enabled - language: - default: - description: - "Enable or disable\ - \ public network access. Default\ - \ to \"Enabled\".\r\nWhen it's\ - \ Enabled, network ACLs still\ - \ apply.\r\nWhen it's Disabled,\ - \ public network access is always\ - \ disabled no matter what you\ - \ set in network ACLs." - name: SignalRPropertiesPublicNetworkAccess - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: publicNetworkAccess - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "DisableLocalAuth\r\ - \nEnable or disable local auth\ - \ with AccessKey\r\nWhen set as\ - \ true, connection with AccessKey=xxx\ - \ won't work." - name: disableLocalAuth - java: - description: - "DisableLocalAuth\r\ - \nEnable or disable local auth\ - \ with AccessKey\r\nWhen set as\ - \ true, connection with AccessKey=xxx\ - \ won't work." - name: disableLocalAuth - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id255 - apiVersions: [] - defaultValue: false - language: - default: - description: - "DisableLocalAuth\r\ - \nEnable or disable local auth\ - \ with AccessKey\r\nWhen set\ - \ as true, connection with AccessKey=xxx\ - \ won't work." - name: Boolean - protocol: {} - type: BOOLEAN - serializedName: disableLocalAuth - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "DisableLocalAuth\r\ - \nEnable or disable aad auth\r\ - \nWhen set as true, connection\ - \ with AuthType=aad won't work." - name: disableAadAuth - java: - description: - "DisableLocalAuth\r\ - \nEnable or disable aad auth\r\ - \nWhen set as true, connection\ - \ with AuthType=aad won't work." - name: disableAadAuth - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id256 - apiVersions: [] - defaultValue: false - language: - default: - description: - "DisableLocalAuth\r\ - \nEnable or disable aad auth\r\ - \nWhen set as true, connection\ - \ with AuthType=aad won't work." - name: Boolean - protocol: {} - type: BOOLEAN - serializedName: disableAadAuth - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { description: "The kind of the - service, it can be SignalR or RawWebSockets", name: kind } - java: - { - description: - "The kind of the service, - it can be SignalR or RawWebSockets", - name: kind, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id263 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: SIGNAL_R, - } - value: SignalR - - language: - default: - { - description: "", - name: RAW_WEB_SOCKETS, - } - value: RawWebSockets - language: - default: { description: "The kind of - the service, it can be SignalR or - RawWebSockets", name: ServiceKind } - java: - { description: "The kind of the - service, it can be SignalR or RawWebSockets", name: ServiceKind } - protocol: {} - type: CHOICE - serializedName: kind - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A class represent - managed identities used for request - and response, name: identity } - java: { description: A class represent - managed identities used for request - and response, name: identity } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id313 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: A class represent - managed identities used for request - and response, name: ManagedIdentity, namespace: "" } - java: - { description: A class represent - managed identities used for request - and response, name: ManagedIdentity } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Represents - the identity type: systemAssigned, - userAssigned, None", name: type } - java: - { description: "Represents the - identity type: systemAssigned, - userAssigned, None", name: type } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id264 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: NONE, - } - value: None - - language: - default: - { - description: "", - name: SYSTEM_ASSIGNED, - } - value: SystemAssigned - - language: - default: - { - description: "", - name: USER_ASSIGNED, - } - value: UserAssigned - language: - default: - { description: "Represents - the identity type: systemAssigned, - userAssigned, None", name: ManagedIdentityType } - java: - { description: "Represents - the identity type: systemAssigned, - userAssigned, None", name: ManagedIdentityType } - protocol: {} - type: CHOICE - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Get or set - the user assigned identities, name: userAssignedIdentities } - java: - { description: Get or set the - user assigned identities, name: userAssignedIdentities } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id271 - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id314 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Properties - of user assigned identity., name: UserAssignedIdentityProperty, namespace: "" } - java: - { description: Properties - of user assigned identity., name: UserAssignedIdentityProperty } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Get the - principal id for the user - assigned identity, name: principalId } - java: - { description: Get the - principal id for the user - assigned identity, name: principalId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id395 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { description: Get - the principal id for the - user assigned identity, name: UserAssignedIdentityPropertyPrincipalId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: principalId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Get the - client id for the user assigned - identity, name: clientId } - java: - { description: Get the - client id for the user assigned - identity, name: clientId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id396 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { description: Get - the client id for the - user assigned identity, name: UserAssignedIdentityPropertyClientId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: clientId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { description: Get or set - the user assigned identities, name: ManagedIdentityUserAssignedIdentities } - java: - { - description: - Get or set the - user assigned identities, - name: ManagedIdentityUserAssignedIdentities, - } - protocol: {} - type: DICTIONARY - serializedName: userAssignedIdentities - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Get the principal\ - \ id for the system assigned identity.\r\ - \nOnly be used in response." - name: principalId - java: - description: - "Get the principal\ - \ id for the system assigned identity.\r\ - \nOnly be used in response." - name: principalId - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id397 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: - "Get the principal\ - \ id for the system assigned\ - \ identity.\r\nOnly be used\ - \ in response." - name: ManagedIdentityPrincipalId - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: principalId - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Get the tenant id\ - \ for the system assigned identity.\r\ - \nOnly be used in response" - name: tenantId - java: - description: - "Get the tenant id\ - \ for the system assigned identity.\r\ - \nOnly be used in response" - name: tenantId - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id398 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: - "Get the tenant id\ - \ for the system assigned identity.\r\ - \nOnly be used in response" - name: ManagedIdentityTenantId - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: tenantId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: identity - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Metadata pertaining - to creation and last modification - of the resource., name: systemData } - java: - { description: Metadata pertaining - to creation and last modification - of the resource., name: systemData } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id023 - apiVersions: - - { version: "2.0" } - flattenedSchema: false - language: - default: - { description: Metadata pertaining - to creation and last modification - of the resource., name: SystemData, namespace: "" } - java: - { description: Metadata pertaining - to creation and last modification - of the resource., name: SystemData } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The identity - that created the resource., name: createdBy } - java: - { - description: - The identity that - created the resource., - name: createdBy, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id368 - apiVersions: - - { version: "2.0" } - language: - default: - { description: The identity - that created the resource., name: SystemDataCreatedBy } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: createdBy - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The type of - identity that created the resource., name: createdByType } - java: - { - description: - The type of identity - that created the resource., - name: createdByType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id022 - apiVersions: - - { version: "2.0" } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: USER, - } - value: User - - language: - default: - { - description: "", - name: APPLICATION, - } - value: Application - - language: - default: - { - description: "", - name: MANAGED_IDENTITY, - } - value: ManagedIdentity - - language: - default: - { - description: "", - name: KEY, - } - value: Key - language: - default: - { description: The type - of identity that created the - resource., name: CreatedByType } - java: - { description: The type of - identity that created the resource., name: CreatedByType } - protocol: {} - type: CHOICE - serializedName: createdByType - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The timestamp - of resource creation (UTC)., name: createdAt } - java: - { description: The timestamp - of resource creation (UTC)., name: createdAt } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id268 - apiVersions: - - { version: "2.0" } - format: DATE_TIME - language: - default: - { description: The timestamp - of resource creation (UTC)., name: SystemDataCreatedAt } - protocol: {} - type: DATE_TIME - serializedName: createdAt - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The identity - that last modified the resource., name: lastModifiedBy } - java: - { - description: - The identity that - last modified the resource., - name: lastModifiedBy, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id369 - apiVersions: - - { version: "2.0" } - language: - default: - { description: The identity - that last modified the resource., name: SystemDataLastModifiedBy } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: lastModifiedBy - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The type of - identity that last modified the - resource., name: lastModifiedByType } - java: - { - description: - The type of identity - that last modified the resource., - name: lastModifiedByType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id022 - serializedName: lastModifiedByType - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The timestamp - of resource last modification - (UTC), name: lastModifiedAt } - java: - { description: The timestamp - of resource last modification - (UTC), name: lastModifiedAt } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id269 - apiVersions: - - { version: "2.0" } - format: DATE_TIME - language: - default: - { description: The timestamp - of resource last modification - (UTC), name: SystemDataLastModifiedAt } - protocol: {} - type: DATE_TIME - serializedName: lastModifiedAt - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: systemData - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id026 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: A custom certificate., - name: CustomCertificate, - namespace: "", - } - java: - { - description: A custom certificate., - name: CustomCertificate, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id014 - - *id017 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id025 - apiVersions: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - java: { name: ProxyResource } - maxProperties: 0.0 - minProperties: 0.0 - properties: &id029 - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: - the fully qualified - resource ID for the resource, - name: id, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the name of the - resource, name: name } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the type of the - resource, name: type } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: type - stronglyTypedHeader: false - immediate: - - *id014 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Metadata pertaining - to creation and last modification - of the resource., name: systemData } - java: - { description: Metadata pertaining - to creation and last modification - of the resource., name: systemData } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id023 - serializedName: systemData - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Custom certificate - properties., name: properties } - java: - { description: Custom certificate - properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id316 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: true - language: - default: - { description: Custom certificate - properties., name: CustomCertificateProperties, namespace: "" } - java: - { description: Custom certificate - properties., name: CustomCertificateProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Provisioning - state of the resource., name: provisioningState } - java: - { - description: - Provisioning state - of the resource., - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id024 - serializedName: provisioningState - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { description: Base uri of - the KeyVault that stores certificate., name: keyVaultBaseUri } - java: - { description: Base uri of the - KeyVault that stores certificate., name: keyVaultBaseUri } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id400 - apiVersions: - - { version: "2023-02-01" } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - language: - default: - { description: Base uri - of the KeyVault that stores - certificate., name: CustomCertificatePropertiesKeyVaultBaseUri } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyVaultBaseUri - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { description: Certificate - secret name., name: keyVaultSecretName } - java: - { - description: - Certificate secret - name., - name: keyVaultSecretName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id401 - apiVersions: - - { version: "2023-02-01" } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - language: - default: - { description: Certificate - secret name., name: CustomCertificatePropertiesKeyVaultSecretName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyVaultSecretName - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { description: Certificate - secret version., name: keyVaultSecretVersion } - java: - { - description: - Certificate secret - version., - name: keyVaultSecretVersion, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id402 - apiVersions: - - { version: "2023-02-01" } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - language: - default: - { description: Certificate - secret version., name: CustomCertificatePropertiesKeyVaultSecretVersion } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyVaultSecretVersion - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id027 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: A custom domain, - name: CustomDomain, - namespace: "", - } - java: - { - description: A custom domain, - name: CustomDomain, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id014 - - *id017 - - *id025 - immediate: - - *id014 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Metadata pertaining - to creation and last modification - of the resource., name: systemData } - java: - { description: Metadata pertaining - to creation and last modification - of the resource., name: systemData } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id023 - serializedName: systemData - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Properties of a - custom domain., name: properties } - java: - { - description: - Properties of a custom - domain., - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id318 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: true - language: - default: - { description: Properties of - a custom domain., name: CustomDomainProperties, namespace: "" } - java: { description: Properties of a - custom domain., name: CustomDomainProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Provisioning - state of the resource., name: provisioningState } - java: - { - description: - Provisioning state - of the resource., - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id024 - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The custom - domain name., name: domainName } - java: - { - description: - The custom domain - name., - name: domainName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id404 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The custom - domain name., name: CustomDomainPropertiesDomainName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: domainName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Reference to - a resource., name: customCertificate } - java: - { description: Reference to a - resource., name: customCertificate } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id319 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Reference - to a resource., name: ResourceReference, namespace: "" } - java: - { description: Reference to - a resource., name: ResourceReference } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Resource - ID., name: Id } - java: - { - description: Resource ID., - name: id, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id405 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: - Resource - ID., - name: ResourceReferenceId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: customCertificate - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id028 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: Private link resource, - name: PrivateLinkResource, - namespace: "", - } - java: - { - description: Private link resource, - name: PrivateLinkResource, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id014 - - *id017 - - *id025 - immediate: - - *id014 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Private link resource - properties, name: properties } - java: - { description: Private link resource - properties, name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id322 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: true - language: - default: { description: Private link - resource properties, name: PrivateLinkResourceProperties, namespace: "" } - java: - { - description: - Private link resource - properties, - name: PrivateLinkResourceProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Group Id of - the private link resource, name: groupId } - java: - { description: Group Id of the - private link resource, name: groupId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id412 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Group Id - of the private link resource, name: PrivateLinkResourcePropertiesGroupId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: groupId - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - Required members - of the private link resource, - name: requiredMembers, - } - java: - { - description: - Required members - of the private link resource, - name: requiredMembers, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id244 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id413 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: "", - name: PrivateLinkResourcePropertiesRequiredMembersItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Required - members of the private link - resource, name: PrivateLinkResourcePropertiesRequiredMembers } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: requiredMembers - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - Required private - DNS zone names, - name: requiredZoneNames, - } - java: - { - description: - Required private - DNS zone names, - name: requiredZoneNames, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id245 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id414 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: "", - name: PrivateLinkResourcePropertiesRequiredZoneNamesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Required - private DNS zone names, name: PrivateLinkResourcePropertiesRequiredZoneNames } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: requiredZoneNames - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The list of - resources that are onboarded to - private link service, name: shareablePrivateLinkResourceTypes } - java: - { - description: - The list of resources - that are onboarded to private - link service, - name: shareablePrivateLinkResourceTypes, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id246 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id323 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Describes - a resource type that has - been onboarded to private - link service, name: ShareablePrivateLinkResourceType, namespace: "" } - java: - { description: Describes - a resource type that has - been onboarded to private - link service, name: ShareablePrivateLinkResourceType } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The name - of the resource type that - has been onboarded to private - link service, - name: name, - } - java: - { - description: - The name - of the resource type that - has been onboarded to private - link service, - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id415 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { description: The - name of the resource type - that has been onboarded - to private link service, name: ShareablePrivateLinkResourceTypeName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Describes - the properties of a resource - type that has been onboarded - to private link service, - name: properties, - } - java: - { - description: - Describes - the properties of a resource - type that has been onboarded - to private link service, - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id324 - apiVersions: - - { - version: "2023-02-01", - } - flattenedSchema: false - language: - default: - { - description: - Describes - the properties of a resource - type that has been onboarded - to private link service, - name: ShareablePrivateLinkResourceProperties, - namespace: "", - } - java: - { - description: - Describes - the properties of a resource - type that has been onboarded - to private link service, - name: ShareablePrivateLinkResourceProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The - description of the resource - type that has been onboarded - to private link service, - name: description, - } - java: - { - description: - The - description of the resource - type that has been onboarded - to private link service, - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id416 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: - The - description of the - resource type that - has been onboarded - to private link service, - name: ShareablePrivateLinkResourcePropertiesDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The - resource provider group - id for the resource - that has been onboarded - to private link service, - name: groupId, - } - java: - { - description: - The - resource provider group - id for the resource - that has been onboarded - to private link service, - name: groupId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id417 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: - The - resource provider - group id for the resource - that has been onboarded - to private link service, - name: ShareablePrivateLinkResourcePropertiesGroupId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: groupId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The - resource provider type - for the resource that - has been onboarded to - private link service, - name: type, - } - java: - { - description: - The - resource provider type - for the resource that - has been onboarded to - private link service, - name: type, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id418 - apiVersions: - - { - version: "2023-02-01", - } - language: - default: - { - description: - The - resource provider - type for the resource - that has been onboarded - to private link service, - name: ShareablePrivateLinkResourcePropertiesType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: The list - of resources that are onboarded - to private link service, name: PrivateLinkResourcePropertiesShareablePrivateLinkResourceTypes } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: shareablePrivateLinkResourceTypes - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - immediate: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: { description: The core properties of - ARM resources., name: Resource, namespace: "" } - java: { description: The core properties of ARM - resources., name: Resource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Fully qualified resource - Id for the resource., name: Id } - java: - { description: Fully qualified resource - Id for the resource., name: id } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id374 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Fully qualified resource - Id for the resource., name: ResourceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The name of the resource., - name: name, - } - java: - { - description: The name of the resource., - name: name, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id375 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: The name of the resource., - name: ResourceName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The type of the resource - - e.g. "Microsoft.SignalRService/SignalR", name: type } - java: - { description: The type of the resource - - e.g. "Microsoft.SignalRService/SignalR", name: type } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id376 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The type of the resource - - e.g. "Microsoft.SignalRService/SignalR", name: ResourceType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id025 - immediate: - - *id014 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Metadata pertaining to - creation and last modification of the resource., name: systemData } - java: - { description: Metadata pertaining to creation - and last modification of the resource., name: systemData } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id023 - serializedName: systemData - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Private endpoint connection - properties, name: properties } - java: { description: Private endpoint connection - properties, name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id296 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: true - language: - default: - { description: Private endpoint connection - properties, name: PrivateEndpointConnectionProperties, namespace: "" } - java: { description: Private endpoint connection - properties, name: PrivateEndpointConnectionProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Provisioning state - of the resource., name: provisioningState } - java: { description: Provisioning state of - the resource., name: provisioningState } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id024 - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Private endpoint, - name: privateEndpoint, - } - java: - { - description: Private endpoint, - name: privateEndpoint, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id297 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: Private endpoint, - name: PrivateEndpoint, - namespace: "", - } - java: - { - description: Private endpoint, - name: PrivateEndpoint, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Full qualified - Id of the private endpoint, name: Id } - java: { description: Full qualified Id - of the private endpoint, name: id } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id370 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Full qualified - Id of the private endpoint, name: PrivateEndpointId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: privateEndpoint - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Group IDs, name: groupIds } - java: - { description: Group IDs, name: groupIds } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id229 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id371 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: "", - name: PrivateEndpointConnectionPropertiesGroupIdsItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: Group IDs, - name: PrivateEndpointConnectionPropertiesGroupIds, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: groupIds - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Connection state of - the private endpoint connection, name: privateLinkServiceConnectionState } - java: { description: Connection state of the - private endpoint connection, name: privateLinkServiceConnectionState } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id298 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Connection state - of the private endpoint connection, name: PrivateLinkServiceConnectionState, namespace: "" } - java: { description: Connection state of - the private endpoint connection, name: PrivateLinkServiceConnectionState } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Indicates whether - the connection has been Approved/Rejected/Removed - by the owner of the service., name: status } - java: { description: Indicates whether - the connection has been Approved/Rejected/Removed - by the owner of the service., name: status } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id258 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: - { - description: "", - name: PENDING, - } - value: Pending - - language: - default: - { - description: "", - name: APPROVED, - } - value: Approved - - language: - default: - { - description: "", - name: REJECTED, - } - value: Rejected - - language: - default: - { - description: "", - name: DISCONNECTED, - } - value: Disconnected - language: - default: - { description: Indicates whether - the connection has been Approved/Rejected/Removed - by the owner of the service., name: PrivateLinkServiceConnectionStatus } - java: - { description: Indicates whether - the connection has been Approved/Rejected/Removed - by the owner of the service., name: PrivateLinkServiceConnectionStatus } - protocol: {} - type: CHOICE - serializedName: status - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The reason for - approval/rejection of the connection., name: description } - java: - { - description: - The reason for approval/rejection - of the connection., - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id372 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The reason for - approval/rejection of the connection., name: PrivateLinkServiceConnectionStateDescription } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A message indicating - if changes on the service provider - require any updates on the consumer., name: actionsRequired } - java: - { description: A message indicating - if changes on the service provider - require any updates on the consumer., name: actionsRequired } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id373 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: - A message indicating - if changes on the service provider - require any updates on the consumer., - name: PrivateLinkServiceConnectionStateActionsRequired, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: actionsRequired - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: privateLinkServiceConnectionState - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id016 - - *id026 - - *id027 - - *id028 - immediate: - - *id015 - - *id016 - - *id026 - - *id027 - - *id028 - flattenedSchema: false - language: - default: { description: The resource model definition - for a ARM proxy resource. It will have everything - other than required location and tags, name: ProxyResource, namespace: "" } - java: { description: The resource model definition for - a ARM proxy resource. It will have everything other - than required location and tags, name: ProxyResource } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: [] - immediate: [] - properties: *id029 - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id017 - - *id025 - immediate: - - *id014 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Metadata pertaining to creation - and last modification of the resource., name: systemData } - java: { description: Metadata pertaining to creation and - last modification of the resource., name: systemData } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id023 - serializedName: systemData - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Describes the properties of an - existing Shared Private Link Resource, name: properties } - java: { description: Describes the properties of an existing - Shared Private Link Resource, name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id299 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: true - language: - default: { description: Describes the properties of an - existing Shared Private Link Resource, name: SharedPrivateLinkResourceProperties, namespace: "" } - java: { description: Describes the properties of an existing - Shared Private Link Resource, name: SharedPrivateLinkResourceProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The group id from the provider - of resource the shared private link resource is - for, name: groupId } - java: { description: The group id from the provider - of resource the shared private link resource is - for, name: groupId } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id377 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: The group id from the provider - of resource the shared private link resource - is for, name: SharedPrivateLinkResourcePropertiesGroupId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: groupId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The resource id of the resource - the shared private link resource is for, name: privateLinkResourceId } - java: { description: The resource id of the resource - the shared private link resource is for, name: privateLinkResourceId } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id378 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The resource id of the resource - the shared private link resource is for, name: SharedPrivateLinkResourcePropertiesPrivateLinkResourceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: privateLinkResourceId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Provisioning state of the resource., - name: provisioningState, - } - java: - { - description: Provisioning state of the resource., - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id024 - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The request message for requesting - approval of the shared private link resource, name: requestMessage } - java: { description: The request message for requesting - approval of the shared private link resource, name: requestMessage } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id379 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The request message for requesting - approval of the shared private link resource, name: SharedPrivateLinkResourcePropertiesRequestMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: requestMessage - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Status of the shared private - link resource, name: status } - java: { description: Status of the shared private link - resource, name: status } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id259 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: { description: "", name: PENDING } - value: Pending - - language: - default: { description: "", name: APPROVED } - value: Approved - - language: - default: { description: "", name: REJECTED } - value: Rejected - - language: - default: { description: "", name: DISCONNECTED } - value: Disconnected - - language: - default: { description: "", name: TIMEOUT } - value: Timeout - language: - default: { description: Status of the shared private - link resource, name: SharedPrivateLinkResourceStatus } - java: { description: Status of the shared private - link resource, name: SharedPrivateLinkResourceStatus } - protocol: {} - type: CHOICE - serializedName: status - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: The list of the shared private link - resources, name: SharedPrivateLinkResourceListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Request URL that can be used to query - next page of private endpoint connections. Returned when - the total number of requested private endpoint connections - exceed maximum page size., name: nextLink } - java: { description: Request URL that can be used to query next - page of private endpoint connections. Returned when the - total number of requested private endpoint connections exceed - maximum page size., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id420 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: Request URL that can be used to query - next page of private endpoint connections. Returned when - the total number of requested private endpoint connections - exceed maximum page size., name: SharedPrivateLinkResourceListNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id030 - operationGroup: *id007 - operationId: SignalRSharedPrivateLinkResources_List - parameters: - - *id031 - - &id034 - apiVersions: [] - flattened: false - implementation: CLIENT - language: - default: - { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id010 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id267 - apiVersions: [] - language: - default: { description: Api Version (2023-02-01), name: ApiVersion20230201 } - protocol: {} - type: CONSTANT - value: { value: "2023-02-01" } - valueType: *id012 - - *id032 - - &id035 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the - resource. You can obtain this value from the Azure Resource Manager - API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the - portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id011 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id036 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id011 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id035 - - *id036 - - *id037 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources", - uri: "{$host}", - } - signatureParameters: - - *id035 - - *id036 - responses: *id038 - signatureParameters: - - *id035 - - *id036 - - &id039 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRSharedPrivateLinkResources_Get: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - sharedPrivateLinkResourceName: upstream, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_Get.json - responses: - "200": - body: - name: upstream - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/upstream - properties: - { - groupId: sites, - privateLinkResourceId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp, - provisioningState: Succeeded, - requestMessage: Please approve, - status: Approved, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get the specified shared private link resource, name: Get } - java: { description: Get the specified shared private link resource, name: get } - operationGroup: *id007 - operationId: SignalRSharedPrivateLinkResources_Get - parameters: - - *id031 - - &id040 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the shared private link resource, - name: sharedPrivateLinkResourceName, - serializedName: sharedPrivateLinkResourceName, - } - java: - { - description: The name of the shared private link resource, - name: sharedPrivateLinkResourceName, - serializedName: sharedPrivateLinkResourceName, - } - nullable: false - operation: *id039 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - - &id041 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the - resource. You can obtain this value from the Azure Resource Manager - API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the - portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id039 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id042 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id039 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id040 - - *id034 - - *id032 - - *id041 - - *id042 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id039 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", - uri: "{$host}", - } - signatureParameters: - - *id040 - - *id041 - - *id042 - responses: - - language: - default: { description: Success. The response describes a shared private - link resource., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id016 - signatureParameters: - - *id040 - - *id041 - - *id042 - - &id044 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRSharedPrivateLinkResources_CreateOrUpdate: - parameters: - api-version: "2023-02-01" - parameters: - properties: - { - groupId: sites, - privateLinkResourceId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp, - requestMessage: Please approve, - } - resourceGroupName: myResourceGroup - resourceName: mySignalRService - sharedPrivateLinkResourceName: upstream - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRSharedPrivateLinkResources_CreateOrUpdate.json - responses: - "200": - body: - name: upstream - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/upstream - properties: - { - groupId: sites, - privateLinkResourceId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp, - provisioningState: Succeeded, - requestMessage: Please approve, - status: Approved, - } - "201": - body: - name: upstream - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/upstream - properties: - { - groupId: sites, - privateLinkResourceId: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Web/sites/myWebApp, - provisioningState: Succeeded, - requestMessage: Please approve, - status: Approved, - } - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - xmsFlattened: false - xmsLongRunningOperation: true - xmsSkipUrlEncoding: false - language: - default: - { - description: Create or update a shared private link resource, - name: CreateOrUpdate, - } - java: - { - description: Create or update a shared private link resource, - name: createOrUpdate, - } - operationGroup: *id007 - operationId: SignalRSharedPrivateLinkResources_CreateOrUpdate - parameters: - - *id031 - - &id045 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the shared private link resource, - name: sharedPrivateLinkResourceName, - serializedName: sharedPrivateLinkResourceName, - } - java: - { - description: The name of the shared private link resource, - name: sharedPrivateLinkResourceName, - serializedName: sharedPrivateLinkResourceName, - } - nullable: false - operation: *id044 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - - &id046 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the - resource. You can obtain this value from the Azure Resource Manager - API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the - portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id044 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id047 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id044 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id045 - - *id034 - - *id032 - - *id046 - - *id047 - - &id048 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The shared private link resource, name: parameters } - java: { description: The shared private link resource, name: parameters } - nullable: false - operation: *id044 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id016 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id044 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} - uri: "{$host}" - signatureParameters: - - *id045 - - *id046 - - *id047 - - *id048 - responses: - - language: - default: { description: OK. The response indicates the shared private link - resource is updated., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id016 - - language: - default: { description: Created. The response indicates the shared private - link resource is created., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id016 - signatureParameters: - - *id045 - - *id046 - - *id047 - - *id010 - - *id009 - protocol: {} - operationId: SignalRSharedPrivateLinkResources_Delete - parameters: - - *id031 - - &id049 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the shared private link resource, - name: sharedPrivateLinkResourceName, - serializedName: sharedPrivateLinkResourceName, - } - java: - { - description: The name of the shared private link resource, - name: sharedPrivateLinkResourceName, - serializedName: sharedPrivateLinkResourceName, - } - nullable: false - operation: *id010 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - - &id050 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id010 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id051 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id010 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id049 - - *id034 - - *id032 - - *id050 - - *id051 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id010 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", - uri: "{$host}", - } - signatureParameters: - - *id049 - - *id050 - - *id051 - responses: - - language: - default: { description: Success. The response indicates the resource is already - deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: Accepted. The response indicates the delete operation - is performed in the background., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - - language: - default: { description: Success. The response indicates the private endpoint - connection is already deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id049 - - *id050 - - *id051 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id031 - - *id034 -info: { description: REST API for Azure SignalR Service, title: SignalRManagementClient } -language: - default: { description: "", name: SignalRManagementClient } - java: { description: "", name: SignalRManagementClient } -operationGroups: - - &id055 - $key: Operations - codeModel: *id002 - language: - default: { description: "", name: Operations } - java: { description: "", name: Operations } - operations: - - &id058 - apiVersions: &id052 - - { version: "2023-02-01" } - exceptions: &id053 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id054 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Operations_List: - parameters: { api-version: "2023-02-01" } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Operations_List.json - responses: - "200": - body: - nextLink: providers/Microsoft.SignalRService?$skipToken={opaqueString} - value: - - name: Microsoft.SignalRService/SignalR/read - display: { description: View the resource settings and configurations - in the management portal or through API, operation: Manage - SignalR (read-only), provider: Microsoft.SignalRService, resource: SignalR } - isDataAction: false - properties: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id057 - $key: listNext - apiVersions: *id052 - exceptions: *id053 - extensions: *id054 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id055 - parameters: [] - requests: - - language: &id060 - default: { description: Lists all of the available REST API operations - of the Microsoft.SignalRService provider., name: List } - java: { description: Lists all of the available REST API operations of - the Microsoft.SignalRService provider., name: list } - parameters: - - &id059 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id056 { name: nextLink, serializedName: nextLink } - java: *id056 - nullable: false - operation: *id057 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id061 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id058 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id059 - responses: &id062 - - language: - default: - { - description: Success. The response describes the list of operations., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id282 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Result of the request to list REST API operations. - It contains a list of operations., name: OperationList, namespace: "" } - java: { description: Result of the request to list REST API operations. - It contains a list of operations., name: OperationList } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: List of operations supported by the resource - provider., name: value } - java: { description: List of operations supported by the resource - provider., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id225 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id283 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: REST API operation supported by resource - provider., name: Operation, namespace: "" } - java: { description: REST API operation supported by resource - provider., name: Operation } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Name of the operation with format: - {provider}/{resource}/{operation}", name: name } - java: - { - description: "Name of the operation with format: {provider}/{resource}/{operation}", - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id330 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: "Name of the operation with format: - {provider}/{resource}/{operation}", name: OperationName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: If the operation is a data action. - (for data plane rbac), name: isDataAction } - java: { description: If the operation is a data action. (for - data plane rbac), name: isDataAction } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id251 - apiVersions: [] - language: - default: { description: If the operation is a data action. - (for data plane rbac), name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: isDataAction - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The object that describes a operation., - name: display, - } - java: - { - description: The object that describes a operation., - name: display, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id284 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: The object that describes a operation., - name: OperationDisplay, - namespace: "", - } - java: - { - description: The object that describes a operation., - name: OperationDisplay, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Friendly name of the resource provider, - name: provider, - } - java: - { - description: Friendly name of the resource provider, - name: provider, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id331 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: Friendly name of the resource - provider, name: OperationDisplayProvider } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provider - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Resource type on which the operation - is performed., name: resource } - java: { description: Resource type on which the operation - is performed., name: resource } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id332 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Resource type on which the operation - is performed., name: OperationDisplayResource } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resource - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The localized friendly name for - the operation., name: operation } - java: { description: The localized friendly name for the - operation., name: operation } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id333 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: The localized friendly name for - the operation., name: OperationDisplayOperation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: operation - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The localized friendly description - for the operation, name: description } - java: { description: The localized friendly description - for the operation, name: description } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id334 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: The localized friendly description - for the operation, name: OperationDisplayDescription } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: display - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Optional. The intended executor of - the operation; governs the display of the operation in - the RBAC UX and the audit logs UX., name: origin } - java: { description: Optional. The intended executor of the - operation; governs the display of the operation in the - RBAC UX and the audit logs UX., name: origin } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id335 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: Optional. The intended executor of - the operation; governs the display of the operation - in the RBAC UX and the audit logs UX., name: OperationOrigin } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: origin - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Extra Operation properties., name: properties } - java: - { description: Extra Operation properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id285 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: Extra Operation properties., - name: OperationProperties, - namespace: "", - } - java: - { - description: Extra Operation properties., - name: OperationProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: An object that describes a specification., - name: serviceSpecification, - } - java: - { - description: An object that describes a specification., - name: serviceSpecification, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id286 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: An object that describes a specification., - name: ServiceSpecification, - namespace: "", - } - java: - { - description: An object that describes a specification., - name: ServiceSpecification, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Specifications of the Metrics - for Azure Monitoring., name: metricSpecifications } - java: { description: Specifications of the Metrics - for Azure Monitoring., name: metricSpecifications } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id223 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id287 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Specifications of the Metrics - for Azure Monitoring., name: MetricSpecification, namespace: "" } - java: { description: Specifications of the Metrics - for Azure Monitoring., name: MetricSpecification } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Name of the metric., - name: name, - } - java: - { - description: Name of the metric., - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id336 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: Name of the metric., - name: MetricSpecificationName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Localized friendly display - name of the metric., name: displayName } - java: - { description: Localized friendly display - name of the metric., name: displayName } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id337 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: Localized friendly - display name of the metric., name: MetricSpecificationDisplayName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Localized friendly description - of the metric., - name: displayDescription, - } - java: - { - description: - Localized friendly description - of the metric., - name: displayDescription, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id338 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: Localized friendly - description of the metric., name: MetricSpecificationDisplayDescription } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayDescription - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The unit that makes sense - for the metric., name: unit } - java: { description: The unit that makes sense - for the metric., name: unit } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id339 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: The unit that makes - sense for the metric., name: MetricSpecificationUnit } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: unit - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Only provide one value - for this field. Valid values: Average, Minimum, - Maximum, Total, Count.", name: aggregationType } - java: { description: "Only provide one value - for this field. Valid values: Average, Minimum, - Maximum, Total, Count.", name: aggregationType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id340 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: "Only provide one value - for this field. Valid values: Average, - Minimum, Maximum, Total, Count.", name: MetricSpecificationAggregationType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: aggregationType - - apiVersions: [] - isDiscriminator: false - language: - default: - description: - "Optional. If set to true, then\ - \ zero will be returned for time duration\ - \ where no metric is emitted/published.\ - \ \r\nEx. a metric that returns the number\ - \ of times a particular error code was emitted.\ - \ The error code may not appear \r\noften,\ - \ instead of the RP publishing 0, Shoebox\ - \ can auto fill in 0s for time periods where\ - \ nothing was emitted." - name: fillGapWithZero - java: - description: - "Optional. If set to true, then\ - \ zero will be returned for time duration\ - \ where no metric is emitted/published.\ - \ \r\nEx. a metric that returns the number\ - \ of times a particular error code was emitted.\ - \ The error code may not appear \r\noften,\ - \ instead of the RP publishing 0, Shoebox\ - \ can auto fill in 0s for time periods where\ - \ nothing was emitted." - name: fillGapWithZero - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id341 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "Optional. If set to true,\ - \ then zero will be returned for time\ - \ duration where no metric is emitted/published.\ - \ \r\nEx. a metric that returns the number\ - \ of times a particular error code was\ - \ emitted. The error code may not appear\ - \ \r\noften, instead of the RP publishing\ - \ 0, Shoebox can auto fill in 0s for time\ - \ periods where nothing was emitted." - name: MetricSpecificationFillGapWithZero - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: fillGapWithZero - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The name of the metric - category that the metric belongs to. A metric - can only belong to a single category., name: category } - java: - { - description: - The name of the metric category - that the metric belongs to. A metric can - only belong to a single category., - name: category, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id342 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The name of the metric - category that the metric belongs to. A - metric can only belong to a single category., name: MetricSpecificationCategory } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: category - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The dimensions of the - metrics., name: dimensions } - java: - { - description: The dimensions of the metrics., - name: dimensions, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id222 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id288 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Specifications of - the Dimension of metrics., name: Dimension, namespace: "" } - java: { description: Specifications of the - Dimension of metrics., name: Dimension } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The public facing - name of the dimension., name: name } - java: { description: The public facing - name of the dimension., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id343 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: The public facing - name of the dimension., name: DimensionName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Localized friendly - display name of the dimension., name: displayName } - java: - { description: Localized friendly - display name of the dimension., name: displayName } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id344 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { description: Localized friendly - display name of the dimension., name: DimensionDisplayName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Name of the dimension - as it appears in MDM., name: internalName } - java: - { description: Name of the dimension - as it appears in MDM., name: internalName } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id345 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: - Name of the dimension - as it appears in MDM., - name: DimensionInternalName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: internalName - - apiVersions: [] - isDiscriminator: false - language: - default: { description: A Boolean flag - indicating whether this dimension - should be included for the shoebox - export scenario., name: toBeExportedForShoebox } - java: - { - description: - A Boolean flag indicating - whether this dimension should be included - for the shoebox export scenario., - name: toBeExportedForShoebox, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id252 - apiVersions: [] - language: - default: - { description: A Boolean flag - indicating whether this dimension - should be included for the shoebox - export scenario., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: toBeExportedForShoebox - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: The dimensions of the - metrics., name: MetricSpecificationDimensions } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: dimensions - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: Specifications of the Metrics - for Azure Monitoring., name: ServiceSpecificationMetricSpecifications } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: metricSpecifications - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Specifications of the Logs - for Azure Monitoring., name: logSpecifications } - java: { description: Specifications of the Logs for - Azure Monitoring., name: logSpecifications } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id224 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id289 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Specifications of the Logs - for Azure Monitoring., name: LogSpecification, namespace: "" } - java: { description: Specifications of the Logs - for Azure Monitoring., name: LogSpecification } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Name of the log., - name: name, - } - java: - { - description: Name of the log., - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id346 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: Name of the log., - name: LogSpecificationName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Localized friendly display - name of the log., name: displayName } - java: - { description: Localized friendly display - name of the log., name: displayName } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id347 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: Localized friendly - display name of the log., name: LogSpecificationDisplayName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: Specifications of the Logs - for Azure Monitoring., name: ServiceSpecificationLogSpecifications } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: logSpecifications - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: serviceSpecification - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: List of operations supported by the resource - provider., name: OperationListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - java: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id348 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: OperationListNextLink - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id060 - operationGroup: *id055 - operationId: Operations_List - parameters: - - *id031 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id061 - protocol: - http: - { - explode: false, - method: get, - path: /providers/Microsoft.SignalRService/operations, - uri: "{$host}", - } - signatureParameters: [] - responses: *id062 - signatureParameters: [] - - *id057 - protocol: {} - - &id063 - $key: SignalR - codeModel: *id002 - language: - default: { description: "", name: SignalR } - java: { description: "", name: SignalR } - operations: - - &id064 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_CheckNameAvailability: - parameters: - api-version: "2023-02-01" - location: eastus - parameters: { name: mySignalRService, type: Microsoft.SignalRService/SignalR } - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CheckNameAvailability.json - responses: - "200": - body: { message: The name is already taken. Please try a different - name., nameAvailable: false, reason: AlreadyExists } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Checks that the resource name is valid and is not already - in use., name: CheckNameAvailability } - java: { description: Checks that the resource name is valid and is not already - in use., name: checkNameAvailability } - operationGroup: *id063 - operationId: SignalR_CheckNameAvailability - parameters: - - *id031 - - &id065 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: the region, name: location, serializedName: location } - java: { description: the region, name: location, serializedName: location } - nullable: false - operation: *id064 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id065 - - *id034 - - *id032 - - &id066 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Parameters supplied to the operation., name: parameters } - java: { description: Parameters supplied to the operation., name: parameters } - nullable: false - operation: *id064 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id290 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: Data POST-ed to the nameAvailability action, - name: NameAvailabilityParameters, - namespace: "", - } - java: - { - description: Data POST-ed to the nameAvailability action, - name: NameAvailabilityParameters, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The resource type. Can be "Microsoft.SignalRService/SignalR" - or "Microsoft.SignalRService/webPubSub", - name: type, - } - java: - { - description: - The resource type. Can be "Microsoft.SignalRService/SignalR" - or "Microsoft.SignalRService/webPubSub", - name: type, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id353 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: - The resource type. Can be "Microsoft.SignalRService/SignalR" - or "Microsoft.SignalRService/webPubSub", - name: NameAvailabilityParametersType, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The resource name to validate. e.g."my-resource-name", - name: name, - } - java: - { - description: The resource name to validate. e.g."my-resource-name", - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id354 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: The resource name to validate. e.g."my-resource-name", - name: NameAvailabilityParametersName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id064 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability - uri: "{$host}" - signatureParameters: - - *id065 - - *id066 - responses: - - language: - default: - { description: Success. The response describes the name availability., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id291 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Result of the request to check name availability. - It contains a flag and possible reason of failure., name: NameAvailability, namespace: "" } - java: { description: Result of the request to check name availability. It - contains a flag and possible reason of failure., name: NameAvailability } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Indicates whether the name is available or not., - name: nameAvailable, - } - java: - { - description: Indicates whether the name is available or not., - name: nameAvailable, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id253 - apiVersions: [] - language: - default: - { - description: Indicates whether the name is available or not., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: nameAvailable - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The reason of the availability. Required if name - is not available., name: reason } - java: { description: The reason of the availability. Required if name is - not available., name: reason } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id355 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: The reason of the availability. Required if name - is not available., name: NameAvailabilityReason } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: reason - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The message of the operation., name: message } - java: { description: The message of the operation., name: message } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id356 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: The message of the operation., - name: NameAvailabilityMessage, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id065 - - &id072 - apiVersions: &id067 - - { version: "2023-02-01" } - exceptions: &id068 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id069 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_ListBySubscription: - parameters: - { - api-version: "2023-02-01", - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListBySubscription.json - responses: - "200": - body: - value: - - name: mySignalRService - type: Microsoft.SignalRService/SignalR - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService - identity: - { - type: SystemAssigned, - principalId: 00000000-0000-0000-0000-000000000000, - tenantId: 00000000-0000-0000-0000-000000000000, - } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - externalIP: 10.0.0.1 - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - hostName: mysignalrservice.service.signalr.net - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - privateEndpointConnections: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - provisioningState: Succeeded - publicNetworkAccess: Enabled - publicPort: 443 - resourceLogConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - serverPort: 443 - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: true } - upstream: - templates: - - { urlTemplate: "http://foo.com" } - version: "1.0" - sku: { name: Premium_P1, capacity: 1, size: P1, tier: Premium } - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - tags: { key1: value1 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id071 - $key: listBySubscriptionNext - apiVersions: *id067 - exceptions: *id068 - extensions: *id069 - language: - java: { description: Get the next page of items, name: listBySubscriptionNext } - operationGroup: *id063 - parameters: [] - requests: - - language: &id075 - default: - { - description: Handles requests to list all resources in a subscription., - name: ListBySubscription, - } - java: - { - description: Handles requests to list all resources in a subscription., - name: list, - } - parameters: - - &id073 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id070 { name: nextLink, serializedName: nextLink } - java: *id070 - nullable: false - operation: *id071 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id076 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id072 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id073 - responses: &id077 - - language: - default: { description: Success. The response describes the list of resources - in the subscription., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id085 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Object that includes an array of resources - and a possible link for next set., name: SignalRResourceList, namespace: "" } - java: { description: Object that includes an array of resources and - a possible link for next set., name: SignalRResourceList } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: List of the resources, name: value } - java: { description: List of the resources, name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id240 - apiVersions: - - { version: "2023-02-01" } - elementType: *id074 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: List of the resources, name: SignalRResourceListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - java: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id399 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: SignalRResourceListNextLink - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id075 - operationGroup: *id063 - operationId: SignalR_ListBySubscription - parameters: - - *id031 - - *id034 - - *id032 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id076 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/signalR", - uri: "{$host}", - } - signatureParameters: [] - responses: *id077 - signatureParameters: [] - - &id083 - apiVersions: &id078 - - { version: "2023-02-01" } - exceptions: &id079 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id080 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_ListByResourceGroup: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListByResourceGroup.json - responses: - "200": - body: - value: - - name: mySignalRService - type: Microsoft.SignalRService/SignalR - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService - identity: - { - type: SystemAssigned, - principalId: 00000000-0000-0000-0000-000000000000, - tenantId: 00000000-0000-0000-0000-000000000000, - } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - externalIP: 10.0.0.1 - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - hostName: mysignalrservice.service.signalr.net - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - privateEndpointConnections: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - provisioningState: Succeeded - publicNetworkAccess: Enabled - publicPort: 443 - resourceLogConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - serverPort: 443 - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: true } - upstream: - templates: - - { urlTemplate: "http://foo.com" } - version: "1.0" - sku: { name: Premium_P1, capacity: 1, size: P1, tier: Premium } - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - tags: { key1: value1 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id082 - $key: listByResourceGroupNext - apiVersions: *id078 - exceptions: *id079 - extensions: *id080 - language: - java: { description: Get the next page of items, name: listByResourceGroupNext } - operationGroup: *id063 - parameters: [] - requests: - - language: &id086 - default: { description: Handles requests to list all resources in a resource - group., name: ListByResourceGroup } - java: { description: Handles requests to list all resources in a resource - group., name: listByResourceGroup } - parameters: - - &id084 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id081 { name: nextLink, serializedName: nextLink } - java: *id081 - nullable: false - operation: *id082 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id088 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id083 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id084 - responses: &id089 - - language: - default: { description: Success. The response describes the list of resources - in a resourceGroup., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id085 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id086 - operationGroup: *id063 - operationId: SignalR_ListByResourceGroup - parameters: - - *id031 - - *id034 - - *id032 - - &id087 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id083 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id087 - - *id088 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR", - uri: "{$host}", - } - signatureParameters: - - *id087 - responses: *id089 - signatureParameters: - - *id087 - - &id090 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_Get: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Get.json - responses: - "200": - body: - name: mySignalRService - type: Microsoft.SignalRService/SignalR - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService - identity: - { - type: SystemAssigned, - principalId: 00000000-0000-0000-0000-000000000000, - tenantId: 00000000-0000-0000-0000-000000000000, - } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - externalIP: 10.0.0.1 - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - hostName: mysignalrservice.service.signalr.net - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - privateEndpointConnections: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - provisioningState: Succeeded - publicNetworkAccess: Enabled - publicPort: 443 - resourceLogConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - serverPort: 443 - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: true } - upstream: - templates: - - { urlTemplate: "http://foo.com" } - version: "1.0" - sku: { name: Premium_P1, capacity: 1, size: P1, tier: Premium } - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - tags: { key1: value1 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get the resource and its properties., name: Get } - java: { description: Get the resource and its properties., name: getByResourceGroup } - operationGroup: *id063 - operationId: SignalR_Get - parameters: - - *id031 - - *id034 - - *id032 - - &id091 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id090 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id092 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id090 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id091 - - *id092 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id090 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", - uri: "{$host}", - } - signatureParameters: - - *id091 - - *id092 - responses: - - language: - default: - { - description: Success. The response describes the corresponding resource., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id074 - signatureParameters: - - *id091 - - *id092 - - &id093 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_CreateOrUpdate: - parameters: - api-version: "2023-02-01" - parameters: - identity: { type: SystemAssigned } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - publicNetworkAccess: Enabled - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: false } - upstream: - templates: - - auth: - type: ManagedIdentity - managedIdentity: { resource: "api://example" } - categoryPattern: "*" - eventPattern: connect,disconnect - hubPattern: "*" - urlTemplate: https://example.com/chat/api/connect - sku: { name: Premium_P1, capacity: 1, tier: Premium } - tags: { key1: value1 } - resourceGroupName: myResourceGroup - resourceName: mySignalRService - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_CreateOrUpdate.json - responses: - "200": - body: - name: mySignalRService - type: Microsoft.SignalRService/SignalR - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService - identity: - { - type: SystemAssigned, - principalId: 00000000-0000-0000-0000-000000000000, - tenantId: 00000000-0000-0000-0000-000000000000, - } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - externalIP: 10.0.0.1 - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - hostName: mysignalrservice.service.signalr.net - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - privateEndpointConnections: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - provisioningState: Succeeded - publicNetworkAccess: Enabled - publicPort: 443 - resourceLogConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - serverPort: 443 - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: true } - upstream: - templates: - - { urlTemplate: "http://foo.com" } - version: "1.0" - sku: { name: Premium_P1, capacity: 1, size: P1, tier: Premium } - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - tags: { key1: value1 } - "201": - body: - name: mySignalRService - type: Microsoft.SignalRService/SignalR - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService - identity: - { - type: SystemAssigned, - principalId: 00000000-0000-0000-0000-000000000000, - tenantId: 00000000-0000-0000-0000-000000000000, - } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - externalIP: 10.0.0.1 - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - hostName: mysignalrservice.service.signalr.net - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - privateEndpointConnections: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - provisioningState: Succeeded - publicNetworkAccess: Enabled - publicPort: 443 - resourceLogConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - serverPort: 443 - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: true } - upstream: - templates: - - { urlTemplate: "http://foo.com" } - version: "1.0" - sku: { name: Premium_P1, capacity: 1, size: P1, tier: Premium } - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - tags: { key1: value1 } - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - "202": - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - xmsFlattened: false - xmsLongRunningOperation: true - xmsSkipUrlEncoding: false - language: - default: { description: Create or update a resource., name: CreateOrUpdate } - java: { description: Create or update a resource., name: createOrUpdate } - operationGroup: *id063 - operationId: SignalR_CreateOrUpdate - parameters: - - *id031 - - *id034 - - *id032 - - &id094 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id095 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id094 - - *id095 - - &id096 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Parameters for the create or update operation, name: parameters } - java: - { description: Parameters for the create or update operation, name: parameters } - nullable: false - operation: *id093 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id074 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id093 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName} - uri: "{$host}" - signatureParameters: - - *id094 - - *id095 - - *id096 - responses: - - language: - default: { description: Success. The response describes a resource., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id074 - - language: - default: { description: Created. The response describes the new resource and - contains a Location header to query the operation result., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id074 - - language: - default: { description: Accepted. The response indicates the exiting resource - is now updating and contains a Location header to query the operation - result.., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - signatureParameters: - - *id094 - - *id095 - - &id097 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_Delete: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Delete.json - responses: - "200": {} - "202": - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - "204": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: location } - xmsSkipUrlEncoding: false - language: - default: { description: Operation to delete a resource., name: Delete } - java: { description: Operation to delete a resource., name: delete } - operationGroup: *id063 - operationId: SignalR_Delete - parameters: - - *id031 - - *id034 - - *id032 - - &id098 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id097 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id099 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id097 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id098 - - *id099 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id097 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}", - uri: "{$host}", - } - signatureParameters: - - *id098 - - *id099 - responses: - - language: - default: { description: Success. The response indicates the resource is already - deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: Accepted. The response indicates the delete operation - is performed in the background., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - - language: - default: { description: Success. The response indicates the resource is already - deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id098 - - *id099 - - &id100 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_Update: - parameters: - api-version: "2023-02-01" - parameters: - identity: { type: SystemAssigned } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - publicNetworkAccess: Enabled - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: false } - upstream: - templates: - - auth: - type: ManagedIdentity - managedIdentity: { resource: "api://example" } - categoryPattern: "*" - eventPattern: connect,disconnect - hubPattern: "*" - urlTemplate: https://example.com/chat/api/connect - sku: { name: Premium_P1, capacity: 1, tier: Premium } - tags: { key1: value1 } - resourceGroupName: myResourceGroup - resourceName: mySignalRService - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Update.json - responses: - "200": - body: - name: mySignalRService - type: Microsoft.SignalRService/SignalR - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService - identity: - { - type: SystemAssigned, - principalId: 00000000-0000-0000-0000-000000000000, - tenantId: 00000000-0000-0000-0000-000000000000, - } - kind: SignalR - location: eastus - properties: - cors: - allowedOrigins: ["https://foo.com", "https://bar.com"] - disableAadAuth: false - disableLocalAuth: false - externalIP: 10.0.0.1 - features: - - flag: ServiceMode - properties: {} - value: Serverless - - flag: EnableConnectivityLogs - properties: {} - value: "True" - - flag: EnableMessagingLogs - properties: {} - value: "False" - - flag: EnableLiveTrace - properties: {} - value: "False" - hostName: mysignalrservice.service.signalr.net - liveTraceConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - enabled: "false" - networkACLs: - defaultAction: Deny - privateEndpoints: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - allow: [ServerConnection] - publicNetwork: - allow: [ClientConnection] - privateEndpointConnections: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - provisioningState: Succeeded - publicNetworkAccess: Enabled - publicPort: 443 - resourceLogConfiguration: - categories: - - { name: ConnectivityLogs, enabled: "true" } - serverPort: 443 - serverless: { connectionTimeoutInSeconds: 5 } - tls: { clientCertEnabled: true } - upstream: - templates: - - { urlTemplate: "http://foo.com" } - version: "1.0" - sku: { name: Premium_P1, capacity: 1, size: P1, tier: Premium } - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - tags: { key1: value1 } - "202": - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - xmsFlattened: false - xmsLongRunningOperation: true - xmsSkipUrlEncoding: false - language: - default: { description: Operation to update an exiting resource., name: Update } - java: { description: Operation to update an exiting resource., name: update } - operationGroup: *id063 - operationId: SignalR_Update - parameters: - - *id031 - - *id034 - - *id032 - - &id101 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id100 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id102 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id100 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id101 - - *id102 - - &id103 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Parameters for the update operation, name: parameters } - java: { description: Parameters for the update operation, name: parameters } - nullable: false - operation: *id100 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id074 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id100 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: patch - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName} - uri: "{$host}" - signatureParameters: - - *id101 - - *id102 - - *id103 - responses: - - language: - default: { description: Success. The response describes a resource., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id074 - - language: - default: { description: Accepted. The response indicates the exiting resource - is now updating and contains a Location header to query the operation - result.., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - signatureParameters: - - *id101 - - *id102 - - &id104 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_ListKeys: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListKeys.json - responses: - "200": - body: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get the access keys of the resource., name: ListKeys } - java: { description: Get the access keys of the resource., name: listKeys } - operationGroup: *id063 - operationId: SignalR_ListKeys - parameters: - - *id031 - - *id034 - - *id032 - - &id105 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id104 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id106 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id104 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id105 - - *id106 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id104 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys", - uri: "{$host}", - } - signatureParameters: - - *id105 - - *id106 - responses: - - language: - default: { description: Success. The response describes access keys of the - resource., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id111 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: A class represents the access keys of the resource., - name: SignalRKeys, - namespace: "", - } - java: - { - description: A class represents the access keys of the resource., - name: SignalRKeys, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The primary access key., name: primaryKey } - java: { description: The primary access key., name: primaryKey } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id407 - apiVersions: - - { version: "2023-02-01" } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: The primary access key., name: SignalRKeysPrimaryKey } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: primaryKey - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The secondary access key., name: secondaryKey } - java: { description: The secondary access key., name: secondaryKey } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id408 - apiVersions: - - { version: "2023-02-01" } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { description: The secondary access key., name: SignalRKeysSecondaryKey } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: secondaryKey - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: Connection string constructed via the primaryKey, - name: primaryConnectionString, - } - java: - { - description: Connection string constructed via the primaryKey, - name: primaryConnectionString, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id409 - apiVersions: - - { version: "2023-02-01" } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: Connection string constructed via the primaryKey, - name: SignalRKeysPrimaryConnectionString, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: primaryConnectionString - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: Connection string constructed via the secondaryKey, - name: secondaryConnectionString, - } - java: - { - description: Connection string constructed via the secondaryKey, - name: secondaryConnectionString, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id410 - apiVersions: - - { version: "2023-02-01" } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: Connection string constructed via the secondaryKey, - name: SignalRKeysSecondaryConnectionString, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: secondaryConnectionString - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id105 - - *id106 - - &id107 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_RegenerateKey: - parameters: - api-version: "2023-02-01" - parameters: { keyType: Primary } - resourceGroupName: myResourceGroup - resourceName: mySignalRService - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_RegenerateKey.json - responses: - "202": - body: {} - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: azure-async-operation } - xmsSkipUrlEncoding: false - language: - default: { description: Regenerate the access key for the resource. PrimaryKey - and SecondaryKey cannot be regenerated at the same time., name: RegenerateKey } - java: { description: Regenerate the access key for the resource. PrimaryKey and - SecondaryKey cannot be regenerated at the same time., name: regenerateKey } - operationGroup: *id063 - operationId: SignalR_RegenerateKey - parameters: - - *id031 - - *id034 - - *id032 - - &id108 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id107 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id109 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id107 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id108 - - *id109 - - &id110 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Parameter that describes the Regenerate Key Operation., - name: parameters, - } - java: - { - description: Parameter that describes the Regenerate Key Operation., - name: parameters, - } - nullable: false - operation: *id107 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id325 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Parameters describes the request to regenerate - access keys, name: RegenerateKeyParameters, namespace: "" } - java: { description: Parameters describes the request to regenerate access - keys, name: RegenerateKeyParameters } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The type of access key., name: keyType } - java: { description: The type of access key., name: keyType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id265 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: { description: "", name: PRIMARY } - value: Primary - - language: - default: { description: "", name: SECONDARY } - value: Secondary - - language: - default: { description: "", name: SALT } - value: Salt - language: - default: { description: The type of access key., name: KeyType } - java: { description: The type of access key., name: KeyType } - protocol: {} - type: CHOICE - serializedName: keyType - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id107 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey - uri: "{$host}" - signatureParameters: - - *id108 - - *id109 - - *id110 - responses: - - language: - default: { description: Accepted and an async operation is executing in background - to make the new key to take effect. The response contains new access keys - and a Location header to query the async operation result., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["202"] - schema: *id111 - signatureParameters: - - *id108 - - *id109 - - &id112 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_Restart: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_Restart.json - responses: - "202": - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - "204": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: azure-async-operation } - xmsSkipUrlEncoding: false - language: - default: { description: Operation to restart a resource., name: Restart } - java: { description: Operation to restart a resource., name: restart } - operationGroup: *id063 - operationId: SignalR_Restart - parameters: - - *id031 - - *id034 - - *id032 - - &id113 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id112 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id114 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id112 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id113 - - *id114 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id112 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart", - uri: "{$host}", - } - signatureParameters: - - *id113 - - *id114 - responses: - - language: - default: { description: Accepted. The response indicates the restart operation - is performed in the background., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - - language: - default: { description: Success. The response indicates the operation is successful - and no content will be returned., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id113 - - *id114 - - &id115 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalR_ListSkus: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalR_ListSkus.json - responses: - "200": - body: - value: - - capacity: - default: 1 - allowedValues: [0, 1] - maximum: 1 - minimum: 0 - scaleType: Manual - resourceType: Microsoft.SignalRService/SignalR - sku: { name: Free_F1, tier: Free } - - capacity: - default: 1 - allowedValues: [0, 1, 2, 5, 10, 20, 50, 100] - maximum: 100 - minimum: 0 - scaleType: Automatic - resourceType: Microsoft.SignalRService/SignalR - sku: { name: Standard_S1, tier: Standard } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: List all available skus of the resource., name: ListSkus } - java: { description: List all available skus of the resource., name: listSkus } - operationGroup: *id063 - operationId: SignalR_ListSkus - parameters: - - *id031 - - *id034 - - *id032 - - &id116 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id115 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id117 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id115 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id116 - - *id117 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id115 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/skus", - uri: "{$host}", - } - signatureParameters: - - *id116 - - *id117 - responses: - - language: - default: { description: Success. The response describes all available skus - of the resource., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id327 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: The list skus operation response, name: SkuList, namespace: "" } - java: { description: The list skus operation response, name: SkuList } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: The list of skus available for the resource., name: value } - java: { description: The list of skus available for the resource., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id250 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id328 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Describes an available sku.", name: Sku, namespace: "" } - java: { description: Describes an available sku.", name: Sku } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The resource type that this object applies - to, name: resourceType } - java: - { - description: The resource type that this object applies to, - name: resourceType, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id421 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: The resource type that this object applies - to, name: SkuResourceType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resourceType - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The billing information of the resource., name: sku } - java: - { description: The billing information of the resource., name: sku } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id118 - serializedName: sku - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Describes scaling information of a sku., - name: capacity, - } - java: - { - description: Describes scaling information of a sku., - name: capacity, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id329 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: Describes scaling information of a sku., - name: SkuCapacity, - namespace: "", - } - java: - { - description: Describes scaling information of a sku., - name: SkuCapacity, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The lowest permitted capacity for this - resource, name: minimum } - java: - { - description: The lowest permitted capacity for this resource, - name: minimum, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id278 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: The lowest permitted capacity for this - resource, name: SkuCapacityMinimum } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: minimum - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The highest permitted capacity for this - resource, name: maximum } - java: { description: The highest permitted capacity for this - resource, name: maximum } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id279 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: The highest permitted capacity for - this resource, name: SkuCapacityMaximum } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: maximum - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The default capacity., name: default } - java: - { description: The default capacity., name: defaultProperty } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id280 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { - description: The default capacity., - name: SkuCapacityDefault, - } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: default - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: Allows capacity value list., - name: allowedValues, - } - java: - { - description: Allows capacity value list., - name: allowedValues, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id249 - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id281 - apiVersions: [] - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: "", name: ArrayItemschema } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: Allows capacity value list., - name: ArrayOfArrayItemschema, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: allowedValues - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The scale type applicable to the sku., - name: scaleType, - } - java: - { - description: The scale type applicable to the sku., - name: scaleType, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id266 - apiVersions: - - { version: "2023-02-01" } - choiceType: *id012 - choices: - - language: - default: { description: "", name: NONE } - value: None - - language: - default: { description: "", name: MANUAL } - value: Manual - - language: - default: { description: "", name: AUTOMATIC } - value: Automatic - language: - default: - { - description: The scale type applicable to the sku., - name: ScaleType, - } - java: - { - description: The scale type applicable to the sku., - name: ScaleType, - } - protocol: {} - type: CHOICE - serializedName: scaleType - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: capacity - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The list of skus available for the resource., - name: SkuListValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - description: "The URL the client should use to fetch the next page (per\ - \ server side paging).\r\nIt's null for now, added for future use." - name: nextLink - java: - description: "The URL the client should use to fetch the next page (per\ - \ server side paging).\r\nIt's null for now, added for future use." - name: nextLink - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id422 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "The URL the client should use to fetch the next page\ - \ (per server side paging).\r\nIt's null for now, added for future\ - \ use." - name: SkuListNextLink - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id116 - - *id117 - - *id071 - - *id082 - protocol: {} - - &id122 - $key: Usages - codeModel: *id002 - language: - default: { description: "", name: Usages } - java: { description: "", name: Usages } - operations: - - &id125 - apiVersions: &id119 - - { version: "2023-02-01" } - exceptions: &id120 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id121 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Usages_List: - parameters: - { - api-version: "2023-02-01", - location: eastus, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/Usages_List.json - responses: - "200": - body: - nextLink: https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToMoreResults... - value: - - name: { localizedValue: Usage1, value: Usage1 } - currentValue: 0 - id: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/usages/Usage1 - limit: 100 - unit: Count - - name: { localizedValue: Usage2, value: Usage2 } - currentValue: 0 - id: /subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SignalRService/locations/eastus/usages/Usage2 - limit: 100 - unit: Count - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id124 - $key: listNext - apiVersions: *id119 - exceptions: *id120 - extensions: *id121 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id122 - parameters: [] - requests: - - language: &id127 - default: { description: List resource usage quotas by location., name: List } - java: { description: List resource usage quotas by location., name: list } - parameters: - - &id126 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id123 { name: nextLink, serializedName: nextLink } - java: *id123 - nullable: false - operation: *id124 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id129 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id125 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id126 - responses: &id130 - - language: - default: { description: Success. The response describe the usage quotas - of a subscription in specified region., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id292 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Object that includes an array of the resource - usages and a possible link for next set., name: SignalRUsageList, namespace: "" } - java: { description: Object that includes an array of the resource - usages and a possible link for next set., name: SignalRUsageList } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: List of the resource usages, name: value } - java: { description: List of the resource usages, name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id228 - apiVersions: - - { version: "2023-02-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id293 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Object that describes a specific usage - of the resources., name: SignalRUsage, namespace: "" } - java: { description: Object that describes a specific usage of - the resources., name: SignalRUsage } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Fully qualified ARM resource id, name: Id } - java: { description: Fully qualified ARM resource id, name: id } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id357 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: Fully qualified ARM resource id, - name: SignalRUsageId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Current value for the usage quota., - name: currentValue, - } - java: - { - description: Current value for the usage quota., - name: currentValue, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id272 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { - description: Current value for the usage quota., - name: SignalRUsageCurrentValue, - } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 64.0 - protocol: {} - type: INTEGER - serializedName: currentValue - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The maximum permitted value for the - usage quota. If there is no limit, this value will be - -1.", name: limit } - java: { description: "The maximum permitted value for the usage - quota. If there is no limit, this value will be -1.", name: limit } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id273 - apiVersions: - - { version: "2023-02-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: "The maximum permitted value for - the usage quota. If there is no limit, this value will - be -1.", name: SignalRUsageLimit } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 64.0 - protocol: {} - type: INTEGER - serializedName: limit - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Localizable String object containing - the name and a localized value., name: name } - java: { description: Localizable String object containing the - name and a localized value., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id294 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Localizable String object containing - the name and a localized value., name: SignalRUsageName, namespace: "" } - java: { description: Localizable String object containing - the name and a localized value., name: SignalRUsageName } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The identifier of the usage., name: value } - java: - { description: The identifier of the usage., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id358 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: The identifier of the usage., - name: SignalRUsageNameValue, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Localized name of the usage., - name: localizedValue, - } - java: - { - description: Localized name of the usage., - name: localizedValue, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id359 - apiVersions: - - { version: "2023-02-01" } - language: - default: - { - description: Localized name of the usage., - name: SignalRUsageNameLocalizedValue, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: localizedValue - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Representing the units of the usage - quota. Possible values are: Count, Bytes, Seconds, Percent, - CountPerSecond, BytesPerSecond.", name: unit } - java: { description: "Representing the units of the usage quota. - Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, - BytesPerSecond.", name: unit } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id360 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: "Representing the units of the usage - quota. Possible values are: Count, Bytes, Seconds, Percent, - CountPerSecond, BytesPerSecond.", name: SignalRUsageUnit } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: unit - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: List of the resource usages, - name: SignalRUsageListValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - java: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id361 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: SignalRUsageListNextLink - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id127 - operationGroup: *id122 - operationId: Usages_List - parameters: - - *id031 - - &id128 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: the location like "eastus", - name: location, - serializedName: location, - } - java: - { - description: the location like "eastus", - name: location, - serializedName: location, - } - nullable: false - operation: *id125 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id128 - - *id034 - - *id032 - - *id129 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages", - uri: "{$host}", - } - signatureParameters: - - *id128 - responses: *id130 - signatureParameters: - - *id128 - - *id124 - protocol: {} - - &id134 - $key: SignalRCustomCertificates - codeModel: *id002 - language: - default: { description: "", name: SignalRCustomCertificates } - java: { description: "", name: SignalRCustomCertificates } - operations: - - &id137 - apiVersions: &id131 - - { version: "2023-02-01" } - exceptions: &id132 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id133 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomCertificates_List: - parameters: - { - api-version: "2023-02-01", - certificateName: myCert, - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_List.json - responses: - "200": - body: - value: - - name: myCert - type: Microsoft.SignalRService/SignalR/customCertificates - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert - properties: - { - keyVaultBaseUri: "https://myvault.keyvault.azure.net/", - keyVaultSecretName: mycert, - keyVaultSecretVersion: bb6a44b2743f47f68dad0d6cc9756432, - provisioningState: Succeeded, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id136 - $key: listNext - apiVersions: *id131 - exceptions: *id132 - extensions: *id133 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id134 - parameters: [] - requests: - - language: &id139 - default: { description: List all custom certificates., name: List } - java: { description: List all custom certificates., name: list } - parameters: - - &id138 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id135 { name: nextLink, serializedName: nextLink } - java: *id135 - nullable: false - operation: *id136 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id142 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id137 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id138 - responses: &id143 - - language: - default: { description: Success. The response describes custom certificates - of the resource., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id315 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: Custom certificates list., - name: CustomCertificateList, - namespace: "", - } - java: { description: Custom certificates list., name: CustomCertificateList } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: List of custom certificates of this resource., - name: value, - } - java: - { - description: List of custom certificates of this resource., - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id241 - apiVersions: - - { version: "2023-02-01" } - elementType: *id026 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: List of custom certificates of this resource., - name: CustomCertificateListValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - java: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id403 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: CustomCertificateListNextLink - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id139 - operationGroup: *id134 - operationId: SignalRCustomCertificates_List - parameters: - - *id031 - - *id032 - - &id140 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id137 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id141 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id137 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id140 - - *id141 - - *id034 - - *id142 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customCertificates", - uri: "{$host}", - } - signatureParameters: - - *id140 - - *id141 - responses: *id143 - signatureParameters: - - *id140 - - *id141 - - &id144 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomCertificates_Get: - parameters: - { - api-version: "2023-02-01", - certificateName: myCert, - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Get.json - responses: - "200": - body: - name: myCert - type: Microsoft.SignalRService/SignalR/customCertificates - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert - properties: - { - keyVaultBaseUri: "https://myvault.keyvault.azure.net/", - keyVaultSecretName: mycert, - keyVaultSecretVersion: bb6a44b2743f47f68dad0d6cc9756432, - provisioningState: Succeeded, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get a custom certificate., name: Get } - java: { description: Get a custom certificate., name: get } - operationGroup: *id134 - operationId: SignalRCustomCertificates_Get - parameters: - - *id031 - - *id032 - - &id145 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id144 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id146 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id144 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id147 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Custom certificate name, - name: certificateName, - serializedName: certificateName, - } - java: - { - description: Custom certificate name, - name: certificateName, - serializedName: certificateName, - } - nullable: false - operation: *id144 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id145 - - *id146 - - *id147 - - *id034 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id144 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customCertificates/{certificateName}", - uri: "{$host}", - } - signatureParameters: - - *id145 - - *id146 - - *id147 - responses: - - language: - default: { description: Success. The response describe the corresponding custom - certificate., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id026 - signatureParameters: - - *id145 - - *id146 - - *id147 - - &id148 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomCertificates_CreateOrUpdate: - parameters: - api-version: "2023-02-01" - certificateName: myCert - parameters: - properties: - { - keyVaultBaseUri: "https://myvault.keyvault.azure.net/", - keyVaultSecretName: mycert, - keyVaultSecretVersion: bb6a44b2743f47f68dad0d6cc9756432, - } - resourceGroupName: myResourceGroup - resourceName: mySignalRService - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_CreateOrUpdate.json - responses: - "200": - body: - name: myCert - type: Microsoft.SignalRService/SignalR/customCertificates - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert - properties: - { - keyVaultBaseUri: "https://myvault.keyvault.azure.net/", - keyVaultSecretName: mycert, - keyVaultSecretVersion: bb6a44b2743f47f68dad0d6cc9756432, - provisioningState: Succeeded, - } - "201": - body: - name: myCert - type: Microsoft.SignalRService/SignalR/customCertificates - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert - properties: - { - keyVaultBaseUri: "https://myvault.keyvault.azure.net/", - keyVaultSecretName: mycert, - keyVaultSecretVersion: bb6a44b2743f47f68dad0d6cc9756432, - provisioningState: Succeeded, - } - xmsFlattened: false - xmsLongRunningOperation: true - xmsSkipUrlEncoding: false - language: - default: { description: Create or update a custom certificate., name: CreateOrUpdate } - java: { description: Create or update a custom certificate., name: createOrUpdate } - operationGroup: *id134 - operationId: SignalRCustomCertificates_CreateOrUpdate - parameters: - - *id031 - - *id032 - - &id149 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id148 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id150 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id148 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id151 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Custom certificate name, - name: certificateName, - serializedName: certificateName, - } - java: - { - description: Custom certificate name, - name: certificateName, - serializedName: certificateName, - } - nullable: false - operation: *id148 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id149 - - *id150 - - *id151 - - *id034 - - &id152 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "", name: parameters } - java: { description: "", name: parameters } - nullable: false - operation: *id148 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id026 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id148 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json, text/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customCertificates/{certificateName} - uri: "{$host}" - signatureParameters: - - *id149 - - *id150 - - *id151 - - *id152 - responses: - - language: - default: { description: Success. The response describes the certificate., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id026 - - language: - default: { description: Created. The response describes the certificate., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id026 - signatureParameters: - - *id149 - - *id150 - - *id151 - - &id153 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomCertificates_Delete: - parameters: - { - api-version: "2023-02-01", - certificateName: myCert, - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomCertificates_Delete.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Delete a custom certificate., name: Delete } - java: { description: Delete a custom certificate., name: delete } - operationGroup: *id134 - operationId: SignalRCustomCertificates_Delete - parameters: - - *id031 - - *id032 - - &id154 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id153 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id155 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id153 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id156 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Custom certificate name, - name: certificateName, - serializedName: certificateName, - } - java: - { - description: Custom certificate name, - name: certificateName, - serializedName: certificateName, - } - nullable: false - operation: *id153 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id154 - - *id155 - - *id156 - - *id034 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id153 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customCertificates/{certificateName}", - uri: "{$host}", - } - signatureParameters: - - *id154 - - *id155 - - *id156 - responses: - - language: - default: { description: Success., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id154 - - *id155 - - *id156 - - *id136 - protocol: {} - - &id160 - $key: SignalRCustomDomains - codeModel: *id002 - language: - default: { description: "", name: SignalRCustomDomains } - java: { description: "", name: SignalRCustomDomains } - operations: - - &id163 - apiVersions: &id157 - - { version: "2023-02-01" } - exceptions: &id158 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id159 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomDomains_List: - parameters: - { - name: myDomain, - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_List.json - responses: - "200": - body: - value: - - name: myDomain - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customDomains/myDomain - properties: - customCertificate: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert, - } - domainName: example.com - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id162 - $key: listNext - apiVersions: *id157 - exceptions: *id158 - extensions: *id159 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id160 - parameters: [] - requests: - - language: &id165 - default: { description: List all custom domains., name: List } - java: { description: List all custom domains., name: list } - parameters: - - &id164 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id161 { name: nextLink, serializedName: nextLink } - java: *id161 - nullable: false - operation: *id162 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id168 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id163 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id164 - responses: &id169 - - language: - default: { description: Success. The response describes custom domains - of the resource., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id317 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { description: Custom domains list, name: CustomDomainList, namespace: "" } - java: { description: Custom domains list, name: CustomDomainList } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: List of custom domains that bind to this - resource., name: value } - java: - { - description: List of custom domains that bind to this resource., - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id242 - apiVersions: - - { version: "2023-02-01" } - elementType: *id027 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: { description: List of custom domains that bind to this - resource., name: CustomDomainListValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - java: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id406 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: CustomDomainListNextLink - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id165 - operationGroup: *id160 - operationId: SignalRCustomDomains_List - parameters: - - *id031 - - *id032 - - &id166 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id163 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id167 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id163 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id166 - - *id167 - - *id034 - - *id168 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customDomains", - uri: "{$host}", - } - signatureParameters: - - *id166 - - *id167 - responses: *id169 - signatureParameters: - - *id166 - - *id167 - - &id170 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomDomains_Get: - parameters: - { - name: example, - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Get.json - responses: - "200": - body: - name: myDomain - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customDomains/myDomain - properties: - customCertificate: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert, - } - domainName: example.com - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get a custom domain., name: Get } - java: { description: Get a custom domain., name: get } - operationGroup: *id160 - operationId: SignalRCustomDomains_Get - parameters: - - *id031 - - *id032 - - &id171 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id170 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id172 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id170 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id173 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Custom domain name., name: name, serializedName: name } - java: { description: Custom domain name., name: name, serializedName: name } - nullable: false - operation: *id170 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id171 - - *id172 - - *id173 - - *id034 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id170 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customDomains/{name}", - uri: "{$host}", - } - signatureParameters: - - *id171 - - *id172 - - *id173 - responses: - - language: - default: { description: Success. The response describe the corresponding custom - domain., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id171 - - *id172 - - *id173 - - &id174 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomDomains_CreateOrUpdate: - parameters: - name: myDomain - api-version: "2023-02-01" - parameters: - properties: - customCertificate: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert, - } - domainName: example.com - resourceGroupName: myResourceGroup - resourceName: mySignalRService - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_CreateOrUpdate.json - responses: - "201": - body: - name: myDomain - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customDomains/myDomain - properties: - customCertificate: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/customCertificates/myCert, - } - domainName: example.com - provisioningState: Succeeded - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - xmsFlattened: false - xmsLongRunningOperation: true - xmsSkipUrlEncoding: false - language: - default: { description: Create or update a custom domain., name: CreateOrUpdate } - java: { description: Create or update a custom domain., name: createOrUpdate } - operationGroup: *id160 - operationId: SignalRCustomDomains_CreateOrUpdate - parameters: - - *id031 - - *id032 - - &id175 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id174 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id176 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id174 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id177 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Custom domain name., name: name, serializedName: name } - java: { description: Custom domain name., name: name, serializedName: name } - nullable: false - operation: *id174 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id175 - - *id176 - - *id177 - - *id034 - - &id178 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "", name: parameters } - java: { description: "", name: parameters } - nullable: false - operation: *id174 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id027 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id174 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json, text/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customDomains/{name} - uri: "{$host}" - signatureParameters: - - *id175 - - *id176 - - *id177 - - *id178 - responses: - - language: - default: { description: Created. The response describes the custom domain and - contains a Location header to query the operation result., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id027 - signatureParameters: - - *id175 - - *id176 - - *id177 - - &id179 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRCustomDomains_Delete: - parameters: - { - name: example, - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRCustomDomains_Delete.json - responses: - "200": {} - "202": - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - "204": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: location } - xmsSkipUrlEncoding: false - language: - default: { description: Delete a custom domain., name: Delete } - java: { description: Delete a custom domain., name: delete } - operationGroup: *id160 - operationId: SignalRCustomDomains_Delete - parameters: - - *id031 - - *id032 - - &id180 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id179 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id181 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id179 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id182 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Custom domain name., name: name, serializedName: name } - java: { description: Custom domain name., name: name, serializedName: name } - nullable: false - operation: *id179 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id032 - - *id180 - - *id181 - - *id182 - - *id034 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id179 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/customDomains/{name}", - uri: "{$host}", - } - signatureParameters: - - *id180 - - *id181 - - *id182 - responses: - - language: - default: { description: Success. The response indicates the custom domain is - deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: Accepted. The response indicates the operation is performed - in the background., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - - language: - default: { description: Success. The response indicates the custom domain is - deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id180 - - *id181 - - *id182 - - *id162 - protocol: {} - - &id186 - $key: SignalRPrivateEndpointConnections - codeModel: *id002 - language: - default: { description: "", name: SignalRPrivateEndpointConnections } - java: { description: "", name: SignalRPrivateEndpointConnections } - operations: - - &id189 - apiVersions: &id183 - - { version: "2023-02-01" } - exceptions: &id184 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id185 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRPrivateEndpointConnections_List: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_List.json - responses: - "200": - body: - value: - - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - groupIds: [signalr] - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id188 - $key: listNext - apiVersions: *id183 - exceptions: *id184 - extensions: *id185 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id186 - parameters: [] - requests: - - language: &id191 - default: { description: List private endpoint connections, name: List } - java: { description: List private endpoint connections, name: list } - parameters: - - &id190 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id187 { name: nextLink, serializedName: nextLink } - java: *id187 - nullable: false - operation: *id188 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id194 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id189 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id190 - responses: &id195 - - language: - default: { description: Success. The response describes a list of private - endpoint connections., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id320 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: - { - description: A list of private endpoint connections, - name: PrivateEndpointConnectionList, - namespace: "", - } - java: - { - description: A list of private endpoint connections, - name: PrivateEndpointConnectionList, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: The list of the private endpoint connections, - name: value, - } - java: - { - description: The list of the private endpoint connections, - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id243 - apiVersions: - - { version: "2023-02-01" } - elementType: *id015 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: The list of the private endpoint connections, - name: PrivateEndpointConnectionListValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Request URL that can be used to query next - page of private endpoint connections. Returned when the total - number of requested private endpoint connections exceed maximum - page size., name: nextLink } - java: { description: Request URL that can be used to query next page - of private endpoint connections. Returned when the total number - of requested private endpoint connections exceed maximum page - size., name: nextLink } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id411 - apiVersions: - - { version: "2023-02-01" } - language: - default: { description: Request URL that can be used to query next - page of private endpoint connections. Returned when the total - number of requested private endpoint connections exceed maximum - page size., name: PrivateEndpointConnectionListNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id191 - operationGroup: *id186 - operationId: SignalRPrivateEndpointConnections_List - parameters: - - *id031 - - *id034 - - *id032 - - &id192 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id189 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id193 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id189 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id192 - - *id193 - - *id194 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections", - uri: "{$host}", - } - signatureParameters: - - *id192 - - *id193 - responses: *id195 - signatureParameters: - - *id192 - - *id193 - - &id196 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRPrivateEndpointConnections_Get: - parameters: - { - api-version: "2023-02-01", - privateEndpointConnectionName: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e, - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Get.json - responses: - "200": - body: - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - groupIds: [signalr] - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get the specified private endpoint connection, name: Get } - java: { description: Get the specified private endpoint connection, name: get } - operationGroup: *id186 - operationId: SignalRPrivateEndpointConnections_Get - parameters: - - *id031 - - &id197 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the private endpoint connection, - name: privateEndpointConnectionName, - serializedName: privateEndpointConnectionName, - } - java: - { - description: The name of the private endpoint connection, - name: privateEndpointConnectionName, - serializedName: privateEndpointConnectionName, - } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - - &id198 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id199 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id197 - - *id034 - - *id032 - - *id198 - - *id199 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id196 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - uri: "{$host}", - } - signatureParameters: - - *id197 - - *id198 - - *id199 - responses: - - language: - default: { description: Success. The response describes a private endpoint - connection., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id015 - signatureParameters: - - *id197 - - *id198 - - *id199 - - &id200 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRPrivateEndpointConnections_Update: - parameters: - api-version: "2023-02-01" - parameters: - properties: - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: { actionsRequired: None, status: Approved } - privateEndpointConnectionName: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - resourceGroupName: myResourceGroup - resourceName: mySignalRService - subscriptionId: 00000000-0000-0000-0000-000000000000 - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Update.json - responses: - "200": - body: - name: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - type: Microsoft.SignalRService/SignalR/privateEndpointConnections - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateEndpointConnections/mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e - properties: - groupIds: [signalr] - privateEndpoint: - { - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.Network/privateEndpoints/myPrivateEndpoint, - } - privateLinkServiceConnectionState: - { actionsRequired: None, status: Approved } - provisioningState: Succeeded - systemData: - { - createdAt: "2015-02-03T04:05:06Z", - createdBy: string, - createdByType: User, - lastModifiedAt: "2015-02-03T04:05:06Z", - lastModifiedBy: string, - lastModifiedByType: User, - } - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { description: Update the state of specified private endpoint connection, name: Update } - java: - { description: Update the state of specified private endpoint connection, name: update } - operationGroup: *id186 - operationId: SignalRPrivateEndpointConnections_Update - parameters: - - *id031 - - &id201 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the private endpoint connection, - name: privateEndpointConnectionName, - serializedName: privateEndpointConnectionName, - } - java: - { - description: The name of the private endpoint connection, - name: privateEndpointConnectionName, - serializedName: privateEndpointConnectionName, - } - nullable: false - operation: *id200 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - - &id202 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id200 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id203 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id200 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id201 - - *id034 - - *id032 - - *id202 - - *id203 - - &id204 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The resource of private endpoint and its properties, - name: parameters, - } - java: - { - description: The resource of private endpoint and its properties, - name: parameters, - } - nullable: false - operation: *id200 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id015 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id200 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - uri: "{$host}" - signatureParameters: - - *id201 - - *id202 - - *id203 - - *id204 - responses: - - language: - default: { description: OK. The response indicates the private endpoint connection - is updated successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id015 - signatureParameters: - - *id201 - - *id202 - - *id203 - - &id205 - apiVersions: - - { version: "2023-02-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRPrivateEndpointConnections_Delete: - parameters: - { - api-version: "2023-02-01", - privateEndpointConnectionName: mysignalrservice.1fa229cd-bf3f-47f0-8c49-afb36723997e, - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateEndpointConnections_Delete.json - responses: - "200": {} - "202": - headers: - { - Azure-AsyncOperation: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationStatus...", - Location: "https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToOperationResult...", - } - "204": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: location } - xmsSkipUrlEncoding: false - language: - default: { description: Delete the specified private endpoint connection, name: Delete } - java: { description: Delete the specified private endpoint connection, name: delete } - operationGroup: *id186 - operationId: SignalRPrivateEndpointConnections_Delete - parameters: - - *id031 - - &id206 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the private endpoint connection, - name: privateEndpointConnectionName, - serializedName: privateEndpointConnectionName, - } - java: - { - description: The name of the private endpoint connection, - name: privateEndpointConnectionName, - serializedName: privateEndpointConnectionName, - } - nullable: false - operation: *id205 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - *id034 - - *id032 - - &id207 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id205 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id208 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id205 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id206 - - *id034 - - *id032 - - *id207 - - *id208 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id205 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}", - uri: "{$host}", - } - signatureParameters: - - *id206 - - *id207 - - *id208 - responses: - - language: - default: { description: Success. The response indicates the resource is already - deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: Accepted. The response indicates the delete operation - is performed in the background., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - - language: - default: { description: Success. The response indicates the private endpoint - connection is already deleted., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id206 - - *id207 - - *id208 - - *id188 - protocol: {} - - &id212 - $key: SignalRPrivateLinkResources - codeModel: *id002 - language: - default: { description: "", name: SignalRPrivateLinkResources } - java: { description: "", name: SignalRPrivateLinkResources } - operations: - - &id215 - apiVersions: &id209 - - { version: "2023-02-01" } - exceptions: &id210 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id003 - extensions: &id211 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SignalRPrivateLinkResources_List: - parameters: - { - api-version: "2023-02-01", - resourceGroupName: myResourceGroup, - resourceName: mySignalRService, - subscriptionId: 00000000-0000-0000-0000-000000000000, - } - x-ms-original-file: https://github.com/Azure/azure-rest-api-specs/blob/main/specification/signalr/resource-manager/Microsoft.SignalRService/stable/2023-02-01/examples/SignalRPrivateLinkResources_List.json - responses: - "200": - body: - nextLink: https://management.azure.com/subscriptions/subid/providers/Microsoft.SignalRService/...pathToMoreResults... - value: - - name: myPrivateLink - type: privateLinkResources - id: /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService/privateLinkResources/myPrivateLink - properties: - groupId: signalr - requiredMembers: [signalr] - requiredZoneNames: [privatelink.service.signalr.net] - shareablePrivateLinkResourceTypes: - - name: site - properties: { type: Microsoft.Web/sites, description: Azure - App Service can be used as an upstream, groupId: sites } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id214 - $key: listNext - apiVersions: *id209 - exceptions: *id210 - extensions: *id211 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id212 - parameters: [] - requests: - - language: &id217 - default: { description: Get the private link resources that need to be - created for a resource., name: List } - java: { description: Get the private link resources that need to be created - for a resource., name: list } - parameters: - - &id216 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id213 { name: nextLink, serializedName: nextLink } - java: *id213 - nullable: false - operation: *id214 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id031 - - &id220 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id215 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id043 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id216 - responses: &id221 - - language: - default: { description: Success. The response describes a list of private - link resources., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id321 - apiVersions: - - { version: "2023-02-01" } - flattenedSchema: false - language: - default: { description: Contains a list of PrivateLinkResource and - a possible link to query more results, name: PrivateLinkResourceList, namespace: "" } - java: { description: Contains a list of PrivateLinkResource and a possible - link to query more results, name: PrivateLinkResourceList } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: List of PrivateLinkResource, name: value } - java: { description: List of PrivateLinkResource, name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id247 - apiVersions: - - { version: "2023-02-01" } - elementType: *id028 - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - language: - default: - { - description: List of PrivateLinkResource, - name: PrivateLinkResourceListValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - java: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: nextLink - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id419 - apiVersions: - - { version: "2023-02-01" } - language: - default: - description: "The URL the client should use to fetch the next\ - \ page (per server side paging).\r\nIt's null for now, added\ - \ for future use." - name: PrivateLinkResourceListNextLink - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id217 - operationGroup: *id212 - operationId: SignalRPrivateLinkResources_List - parameters: - - *id031 - - *id034 - - *id032 - - &id218 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group that contains the resource. - You can obtain this value from the Azure Resource Manager API or the portal., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id215 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - - &id219 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - java: - { - description: The name of the resource., - name: resourceName, - serializedName: resourceName, - } - nullable: false - operation: *id215 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id033 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id031 - - *id034 - - *id032 - - *id218 - - *id219 - - *id220 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/privateLinkResources", - uri: "{$host}", - } - signatureParameters: - - *id218 - - *id219 - responses: *id221 - signatureParameters: - - *id218 - - *id219 - - *id214 - protocol: {} - - *id007 -protocol: - http: { explode: false } -schemas: - ands: [] - arrays: - - *id222 - - *id223 - - *id224 - - *id225 - - *id226 - - *id227 - - *id228 - - *id229 - - *id230 - - *id231 - - *id232 - - *id233 - - *id234 - - *id235 - - *id236 - - *id237 - - *id238 - - *id239 - - *id240 - - *id241 - - *id242 - - *id243 - - *id244 - - *id245 - - *id246 - - *id247 - - *id248 - - *id249 - - *id250 - binaries: [] - booleans: - - *id251 - - *id252 - - *id253 - - *id254 - - *id255 - - *id256 - byteArrays: [] - chars: [] - choices: - - *id257 - - *id024 - - *id258 - - *id259 - - *id260 - - *id261 - - *id262 - - *id021 - - *id263 - - *id264 - - *id265 - - *id266 - constants: - - *id267 - - *id043 - credentials: [] - dateTimes: - - *id268 - - *id269 - dates: [] - dictionaries: - - *id270 - - *id271 - - apiVersions: [] - elementType: *id033 - language: - default: { description: Tags of the service which is a list of key value pairs - that describe the resource., name: TrackedResourceTags } - java: { description: Tags of the service which is a list of key value pairs that - describe the resource., name: TrackedResourceTags } - protocol: {} - type: DICTIONARY - durations: [] - flags: [] - groups: [] - numbers: - - *id272 - - *id273 - - *id274 - - *id275 - - *id276 - - *id277 - - *id278 - - *id279 - - *id280 - - *id281 - objects: - - *id282 - - *id283 - - *id284 - - *id285 - - *id286 - - *id287 - - *id288 - - *id289 - - *id003 - - *id290 - - *id291 - - *id292 - - *id293 - - *id294 - - *id085 - - *id074 - - *id118 - - *id295 - - *id015 - - *id023 - - *id296 - - *id297 - - *id298 - - *id014 - - *id016 - - *id299 - - *id300 - - *id301 - - *id302 - - *id303 - - *id304 - - *id305 - - *id306 - - *id307 - - *id308 - - *id309 - - *id310 - - *id311 - - *id312 - - *id019 - - *id020 - - *id313 - - *id314 - - *id315 - - *id026 - - *id316 - - *id317 - - *id027 - - *id318 - - *id319 - - *id111 - - *id320 - - *id321 - - *id028 - - *id322 - - *id323 - - *id324 - - *id325 - - *id326 - - *id327 - - *id328 - - *id329 - odataQueries: [] - ors: [] - parameterGroups: [] - sealedChoices: [] - streams: [] - strings: - - *id012 - - *id330 - - *id331 - - *id332 - - *id333 - - *id334 - - *id335 - - *id336 - - *id337 - - *id338 - - *id339 - - *id340 - - *id341 - - *id342 - - *id343 - - *id344 - - *id345 - - *id346 - - *id347 - - *id348 - - *id349 - - *id350 - - *id351 - - *id352 - - *id033 - - *id353 - - *id354 - - *id355 - - *id356 - - *id357 - - *id358 - - *id359 - - *id360 - - *id361 - - *id362 - - *id363 - - *id364 - - *id365 - - *id366 - - *id367 - - *id368 - - *id369 - - *id370 - - *id371 - - *id372 - - *id373 - - *id374 - - *id375 - - *id376 - - *id377 - - *id378 - - *id379 - - *id380 - - *id381 - - *id382 - - *id383 - - *id384 - - *id385 - - *id386 - - *id387 - - *id388 - - *id389 - - *id390 - - *id391 - - *id392 - - *id393 - - *id394 - - *id395 - - *id396 - - *id397 - - *id398 - - apiVersions: - - { version: "2023-02-01" } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - language: - default: { description: The GEO location of the resource. e.g. West US | East - US | North Central US | South Central US., name: TrackedResourceLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id399 - - *id400 - - *id401 - - *id402 - - *id403 - - *id404 - - *id405 - - *id406 - - *id407 - - *id408 - - *id409 - - *id410 - - *id411 - - *id412 - - *id413 - - *id414 - - *id415 - - *id416 - - *id417 - - *id418 - - *id419 - - *id420 - - *id421 - - *id422 - unixtimes: [] - unknowns: [] - uris: [] - uuids: [] - xors: [] -security: - authenticationRequired: true - schemes: - - scopes: !!set { user_impersonation: null } - type: OAUTH2 diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-storage.yaml b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-storage.yaml deleted file mode 100644 index 37244888c5..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/code-model-fluentnamer-storage.yaml +++ /dev/null @@ -1,30234 +0,0 @@ -!!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.CodeModel &id001 -apiVersions: [] -clients: [] -globalParameters: - - &id031 - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattened: false - implementation: CLIENT - language: - default: - { - description: The ID of the target subscription., - name: SubscriptionId, - serializedName: subscriptionId, - } - java: - { - description: The ID of the target subscription., - name: subscriptionId, - serializedName: subscriptionId, - } - nullable: false - operation: &id008 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - Break a lease on a container: - parameters: - accountName: sto328 - api-version: 2020-08-01-preview - containerName: container6185 - monitor: "true" - parameters: - { - action: Break, - breakPeriod: null, - leaseDuration: null, - leaseId: 8698f513-fa75-44a1-b8eb-30ba336af27d, - proposedLeaseId: null, - } - resourceGroupName: res3376 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersLease_Break.json - responses: - "200": - body: { leaseTimeSeconds: "0" } - Acquire a lease on a container: - parameters: - accountName: sto328 - api-version: 2020-08-01-preview - containerName: container6185 - monitor: "true" - parameters: - { - action: Acquire, - breakPeriod: null, - leaseDuration: -1, - leaseId: null, - proposedLeaseId: null, - } - resourceGroupName: res3376 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersLease_Acquire.json - responses: - "200": - body: { leaseId: 8698f513-fa75-44a1-b8eb-30ba336af27d } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "The Lease Container operation establishes and manages - a lock on a container for delete operations. The lock duration can be 15 - to 60 seconds, or can be infinite.", name: Lease } - java: { description: "The Lease Container operation establishes and manages a - lock on a container for delete operations. The lock duration can be 15 to - 60 seconds, or can be infinite.", name: lease } - operationGroup: &id005 - $key: BlobContainers - codeModel: *id001 - language: - default: { description: "", name: BlobContainers } - java: { description: "", name: BlobContainers } - operations: - - &id009 - apiVersions: &id002 - - { version: "2021-01-01" } - exceptions: &id003 [] - extensions: &id004 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - ListContainers: - parameters: - { - accountName: sto1590, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res9290, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersList.json - responses: - "200": - body: - nextLink: https://sto1590endpoint/subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/blobServices/default/containers?api-version=2020-08-01-preview&$maxpagesize=2&$skipToken=/sto1590/container5103 - value: - - name: container1644 - type: Microsoft.Storage/storageAccounts/blobServices/containers - etag: '"0x8D589847D51C7DE"' - id: /subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/blobServices/default/containers/container1644 - properties: - { - hasImmutabilityPolicy: false, - hasLegalHold: false, - lastModifiedTime: "2018-03-14T08:20:47Z", - leaseState: Available, - leaseStatus: Unlocked, - publicAccess: Container, - } - - name: container4052 - type: Microsoft.Storage/storageAccounts/blobServices/containers - etag: '"0x8D589847DAB5AF9"' - id: /subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/blobServices/default/containers/container4052 - properties: - { - hasImmutabilityPolicy: false, - hasLegalHold: false, - lastModifiedTime: "2018-03-14T08:20:47Z", - leaseState: Available, - leaseStatus: Unlocked, - publicAccess: None, - } - ListDeletedContainers: - parameters: - { - $include: deleted, - accountName: sto1590, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res9290, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/DeletedBlobContainersList.json - responses: - "200": - body: - value: - - name: container1644 - type: Microsoft.Storage/storageAccounts/blobServices/containers - etag: '"0x8D589847D51C7DE"' - id: /subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/blobServices/default/containers/container1644 - properties: - { - hasImmutabilityPolicy: false, - hasLegalHold: false, - lastModifiedTime: "2018-03-14T08:20:47Z", - leaseState: Available, - leaseStatus: Unlocked, - publicAccess: Container, - } - - name: container4052 - type: Microsoft.Storage/storageAccounts/blobServices/containers - etag: '"0x8D589847DAB5AF9"' - id: /subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/blobServices/default/containers/container4052 - properties: - { - deleted: true, - deletedTime: "2019-12-14T08:20:47Z", - hasImmutabilityPolicy: false, - hasLegalHold: false, - lastModifiedTime: "2018-03-14T08:20:47Z", - leaseState: Expired, - leaseStatus: Unlocked, - publicAccess: None, - remainingRetentionDays: 30, - version: "1234567890", - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id007 - $key: listNext - apiVersions: *id002 - exceptions: *id003 - extensions: *id004 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id005 - parameters: [] - requests: - - language: &id029 - default: { description: Lists all containers and does not support - a prefix like data plane. Also SRP today does not return continuation - token., name: List } - java: { description: Lists all containers and does not support a - prefix like data plane. Also SRP today does not return continuation - token., name: list } - parameters: - - &id011 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id006 { name: nextLink, serializedName: nextLink } - java: *id006 - nullable: false - operation: *id007 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - &id030 - apiVersions: [] - clientDefaultValue: https://management.azure.com - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: CLIENT - language: - default: - { - description: server parameter, - name: endpoint, - serializedName: $host, - } - java: - { - description: server parameter, - name: endpoint, - serializedName: $host, - } - nullable: false - operation: *id008 - origin: modelerfour:synthesized/host - protocol: - http: { explode: false, in: URI } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id010 - apiVersions: [] - language: - default: { description: simple string, name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - &id039 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: - { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id009 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id047 - apiVersions: [] - language: - default: { description: "Accept: application/json", name: Accept } - protocol: {} - type: CONSTANT - value: { value: application/json } - valueType: *id010 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id011 - responses: &id040 - - language: - default: { description: OK -- List Container operation completed - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id575 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "Response schema. Contains list of blobs - returned, and if paging is requested or required, a URL to - next page of containers.", name: ListContainerItems, namespace: "" } - java: { description: "Response schema. Contains list of blobs returned, - and if paging is requested or required, a URL to next page - of containers.", name: ListContainerItems } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: List of blobs containers returned., name: value } - java: { description: List of blobs containers returned., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id391 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id012 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The blob container properties be - listed out., name: ListContainerItem, namespace: "" } - java: { description: The blob container properties be listed - out., name: ListContainerItem } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id013 - apiVersions: - - { version: "1.0" } - children: - all: - - *id012 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id024 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: "Properties of the blob container, - including Id, resource name, resource type, - Etag.", name: BlobContainer, namespace: "" } - java: - { description: "Properties of the blob container, - including Id, resource name, resource type, - Etag.", name: BlobContainer } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id013 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id014 - apiVersions: - - { version: "1.0" } - children: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id142 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The storage account., - name: StorageAccount, - namespace: "", - } - java: - { - description: The storage account., - name: StorageAccount, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id015 - apiVersions: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - java: { name: Resource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: - the fully qualified - resource ID for the resource, - name: id, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the name of the - resource, name: name } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the type of the - resource, name: type } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: type - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - java: - { - description: - the geo-location - where the resource live, - name: location, - } - nullable: false - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: location - - apiVersions: [] - isDiscriminator: false - language: - java: - { description: the tags of the - resource, name: tags } - nullable: false - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: tags - stronglyTypedHeader: false - - *id014 - immediate: - - *id015 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Gets the SKU., - name: sku, - } - java: - { - description: Gets the SKU., - name: sku, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id126 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: The SKU of the - storage account., name: Sku, namespace: "" } - java: - { - description: - The SKU of the storage - account., - name: Sku, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "The SKU name. - Required for account creation; - optional for update. Note that - in older versions, SKU name was - called accountType.", name: name } - java: - { description: "The SKU name. - Required for account creation; - optional for update. Note that - in older versions, SKU name was - called accountType.", name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id117 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: STANDARD_LRS, - } - value: Standard_LRS - - language: - default: - { - description: "", - name: STANDARD_GRS, - } - value: Standard_GRS - - language: - default: - { - description: "", - name: STANDARD_RAGRS, - } - value: Standard_RAGRS - - language: - default: - { - description: "", - name: STANDARD_ZRS, - } - value: Standard_ZRS - - language: - default: - { - description: "", - name: PREMIUM_LRS, - } - value: Premium_LRS - - language: - default: - { - description: "", - name: PREMIUM_ZRS, - } - value: Premium_ZRS - - language: - default: - { - description: "", - name: STANDARD_GZRS, - } - value: Standard_GZRS - - language: - default: - { - description: "", - name: STANDARD_RAGZRS, - } - value: Standard_RAGZRS - language: - default: - { description: "The SKU - name. Required for account creation; - optional for update. Note that - in older versions, SKU name - was called accountType.", name: SkuName } - java: - { - description: - "The SKU name. - Required for account creation; - optional for update. Note that - in older versions, SKU name - was called accountType.", - name: SkuName, - } - protocol: {} - type: CHOICE - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The SKU tier. - This is based on the SKU name., name: tier } - java: - { description: The SKU tier. - This is based on the SKU name., name: tier } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id118 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: STANDARD, - } - value: Standard - - language: - default: - { - description: "", - name: PREMIUM, - } - value: Premium - language: - default: - { description: The SKU tier. - This is based on the SKU name., name: SkuTier } - java: - { description: The SKU tier. - This is based on the SKU name., name: SkuTier } - protocol: {} - type: SEALED_CHOICE - serializedName: tier - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: sku - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Gets the Kind., - name: kind, - } - java: - { - description: Gets the Kind., - name: kind, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id119 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: STORAGE, - } - value: Storage - - language: - default: - { - description: "", - name: STORAGE_V2, - } - value: StorageV2 - - language: - default: - { - description: "", - name: BLOB_STORAGE, - } - value: BlobStorage - - language: - default: - { - description: "", - name: FILE_STORAGE, - } - value: FileStorage - - language: - default: - { - description: "", - name: BLOCK_BLOB_STORAGE, - } - value: BlockBlobStorage - language: - default: - { description: Indicates the - type of storage account., name: Kind } - java: - { description: Indicates the type - of storage account., name: Kind } - protocol: {} - type: CHOICE - serializedName: kind - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The identity of - the resource., name: identity } - java: - { description: The identity of the - resource., name: identity } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id128 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: Identity for - the resource., name: Identity, namespace: "" } - java: - { description: Identity for the - resource., name: Identity } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The principal - ID of resource identity., name: principalId } - java: - { description: The principal - ID of resource identity., name: principalId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id616 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: The principal - ID of resource identity., name: IdentityPrincipalId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: principalId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The tenant - ID of resource., name: tenantId } - java: - { description: The tenant ID - of resource., name: tenantId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id617 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: The tenant - ID of resource., name: IdentityTenantId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: tenantId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The identity - type., name: type } - java: - { - description: The identity type., - name: type, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id422 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: NONE, - } - value: None - - language: - default: - { - description: "", - name: SYSTEM_ASSIGNED, - } - value: SystemAssigned - - language: - default: - { - description: "", - name: USER_ASSIGNED, - } - value: UserAssigned - - language: - default: - { - description: "", - name: SYSTEM_ASSIGNED_USER_ASSIGNED, - } - value: SystemAssigned,UserAssigned - language: - default: - { description: The identity - type., name: IdentityType } - java: - { description: The identity - type., name: IdentityType } - protocol: {} - type: CHOICE - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets or sets - a list of key value pairs that - describe the set of User Assigned - identities that will be used with - this storage account. The key - is the ARM resource identifier - of the identity. Only 1 User Assigned - identity is permitted here., name: userAssignedIdentities } - java: - { description: Gets or sets a - list of key value pairs that describe - the set of User Assigned identities - that will be used with this storage - account. The key is the ARM resource - identifier of the identity. Only - 1 User Assigned identity is permitted - here., name: userAssignedIdentities } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id478 - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id510 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: - UserAssignedIdentity - for the resource., - name: UserAssignedIdentity, - namespace: "", - } - java: - { - description: - UserAssignedIdentity - for the resource., - name: UserAssignedIdentity, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The principal - ID of the identity., - name: principalId, - } - java: - { - description: - The principal - ID of the identity., - name: principalId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id618 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: The - principal ID of the identity., name: UserAssignedIdentityPrincipalId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: principalId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The client - ID of the identity., - name: clientId, - } - java: - { - description: - The client - ID of the identity., - name: clientId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id619 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: The - client ID of the identity., name: UserAssignedIdentityClientId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: clientId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: Gets or sets - a list of key value pairs that - describe the set of User Assigned - identities that will be used - with this storage account. The - key is the ARM resource identifier - of the identity. Only 1 User - Assigned identity is permitted - here., name: IdentityUserAssignedIdentities } - java: - { description: Gets or sets - a list of key value pairs that - describe the set of User Assigned - identities that will be used - with this storage account. The - key is the ARM resource identifier - of the identity. Only 1 User - Assigned identity is permitted - here., name: IdentityUserAssignedIdentities } - protocol: {} - type: DICTIONARY - serializedName: userAssignedIdentities - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: identity - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The extendedLocation - of the resource., name: extendedLocation } - java: - { description: The extendedLocation - of the resource., name: extendedLocation } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id127 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: The complex type - of the extended location., name: ExtendedLocation, namespace: "" } - java: - { description: The complex type - of the extended location., name: ExtendedLocation } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The name of - the extended location., name: name } - java: - { description: The name of the - extended location., name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id615 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: The name - of the extended location., name: ExtendedLocationName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The type of - the extended location., name: type } - java: - { description: The type of the - extended location., name: type } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id421 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: EDGE_ZONE, - } - value: EdgeZone - language: - default: - { description: The type - of extendedLocation., name: ExtendedLocationTypes } - java: - { description: The type of - extendedLocation., name: ExtendedLocationTypes } - protocol: {} - type: CHOICE - serializedName: type - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: extendedLocation - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Properties of the - storage account., name: properties } - java: { description: Properties of the - storage account., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id519 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { description: Properties of - the storage account., name: StorageAccountProperties, namespace: "" } - java: - { description: Properties of the - storage account., name: StorageAccountProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the status - of the storage account at the - time the operation was called., name: provisioningState } - java: - { description: Gets the status - of the storage account at the - time the operation was called., name: provisioningState } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id584 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: CREATING, - } - value: Creating - - language: - default: - { - description: "", - name: RESOLVING_DNS, - } - value: ResolvingDNS - - language: - default: - { - description: "", - name: SUCCEEDED, - } - value: Succeeded - language: - default: - { description: Gets the - status of the storage account - at the time the operation was - called., name: ProvisioningState } - java: - { - description: - Gets the status - of the storage account at the - time the operation was called., - name: ProvisioningState, - } - protocol: {} - type: SEALED_CHOICE - serializedName: provisioningState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Gets the URLs - that are used to perform a retrieval - of a public blob, queue, or table - object. Note that Standard_ZRS - and Premium_LRS accounts only - return the blob endpoint.", name: primaryEndpoints } - java: - { description: "Gets the URLs - that are used to perform a retrieval - of a public blob, queue, or table - object. Note that Standard_ZRS - and Premium_LRS accounts only - return the blob endpoint.", name: primaryEndpoints } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id017 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: "The URIs - that are used to perform a retrieval - of a public blob, queue, table, - web or dfs object.", name: Endpoints, namespace: "" } - java: - { - description: - "The URIs that - are used to perform a retrieval - of a public blob, queue, table, - web or dfs object.", - name: Endpoints, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the - blob endpoint., name: blob } - java: - { - description: - Gets the blob - endpoint., - name: blob, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id636 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Gets - the blob endpoint., name: EndpointsBlob } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: blob - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the - queue endpoint., name: queue } - java: - { - description: - Gets the queue - endpoint., - name: queue, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id637 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Gets - the queue endpoint., name: EndpointsQueue } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: queue - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the - table endpoint., name: table } - java: - { - description: - Gets the table - endpoint., - name: table, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id638 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Gets - the table endpoint., name: EndpointsTable } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: table - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the - file endpoint., name: file } - java: - { - description: - Gets the file - endpoint., - name: file, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id639 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Gets - the file endpoint., name: EndpointsFile } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: file - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the - web endpoint., name: web } - java: - { - description: - Gets the web - endpoint., - name: web, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id640 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Gets - the web endpoint., name: EndpointsWeb } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: web - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the - dfs endpoint., name: dfs } - java: - { - description: - Gets the dfs - endpoint., - name: dfs, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id641 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Gets - the dfs endpoint., name: EndpointsDfs } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: dfs - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Gets the - microsoft routing storage - endpoints., name: microsoftEndpoints } - java: - { - description: - Gets the microsoft - routing storage endpoints., - name: microsoftEndpoints, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id520 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { description: "The - URIs that are used to perform - a retrieval of a public - blob, queue, table, web - or dfs object via a microsoft - routing endpoint.", name: StorageAccountMicrosoftEndpoints, namespace: "" } - java: - { - description: - "The URIs - that are used to perform - a retrieval of a public - blob, queue, table, web - or dfs object via a microsoft - routing endpoint.", - name: StorageAccountMicrosoftEndpoints, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the blob endpoint., - name: blob, - } - java: - { - description: - Gets the - blob endpoint., - name: blob, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id642 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the blob endpoint., - name: StorageAccountMicrosoftEndpointsBlob, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: blob - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the queue endpoint., - name: queue, - } - java: - { - description: - Gets the - queue endpoint., - name: queue, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id643 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the queue endpoint., - name: StorageAccountMicrosoftEndpointsQueue, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: queue - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the table endpoint., - name: table, - } - java: - { - description: - Gets the - table endpoint., - name: table, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id644 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the table endpoint., - name: StorageAccountMicrosoftEndpointsTable, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: table - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the file endpoint., - name: file, - } - java: - { - description: - Gets the - file endpoint., - name: file, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id645 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the file endpoint., - name: StorageAccountMicrosoftEndpointsFile, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: file - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the web endpoint., - name: web, - } - java: - { - description: - Gets the - web endpoint., - name: web, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id646 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the web endpoint., - name: StorageAccountMicrosoftEndpointsWeb, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: web - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the dfs endpoint., - name: dfs, - } - java: - { - description: - Gets the - dfs endpoint., - name: dfs, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id647 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the dfs endpoint., - name: StorageAccountMicrosoftEndpointsDfs, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: dfs - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: microsoftEndpoints - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Gets the - internet routing storage endpoints, name: internetEndpoints } - java: - { - description: - Gets the internet - routing storage endpoints, - name: internetEndpoints, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id521 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { description: "The - URIs that are used to perform - a retrieval of a public - blob, file, web or dfs object - via a internet routing endpoint.", name: StorageAccountInternetEndpoints, namespace: "" } - java: - { - description: - "The URIs - that are used to perform - a retrieval of a public - blob, file, web or dfs object - via a internet routing endpoint.", - name: StorageAccountInternetEndpoints, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the blob endpoint., - name: blob, - } - java: - { - description: - Gets the - blob endpoint., - name: blob, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id648 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the blob endpoint., - name: StorageAccountInternetEndpointsBlob, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: blob - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the file endpoint., - name: file, - } - java: - { - description: - Gets the - file endpoint., - name: file, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id649 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the file endpoint., - name: StorageAccountInternetEndpointsFile, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: file - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the web endpoint., - name: web, - } - java: - { - description: - Gets the - web endpoint., - name: web, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id650 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the web endpoint., - name: StorageAccountInternetEndpointsWeb, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: web - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the dfs endpoint., - name: dfs, - } - java: - { - description: - Gets the - dfs endpoint., - name: dfs, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id651 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Gets - the dfs endpoint., - name: StorageAccountInternetEndpointsDfs, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: dfs - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: internetEndpoints - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: primaryEndpoints - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets the location - of the primary data center for - the storage account., - name: primaryLocation, - } - java: - { - description: - Gets the location - of the primary data center for - the storage account., - name: primaryLocation, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id652 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Gets the - location of the primary data - center for the storage account., name: StorageAccountPropertiesPrimaryLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: primaryLocation - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the status - indicating whether the primary - location of the storage account - is available or unavailable., name: statusOfPrimary } - java: - { description: Gets the status - indicating whether the primary - location of the storage account - is available or unavailable., name: statusOfPrimary } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id016 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: AVAILABLE, - } - value: available - - language: - default: - { - description: "", - name: UNAVAILABLE, - } - value: unavailable - language: - default: - { description: Gets the - status indicating whether the - primary location of the storage - account is available or unavailable., name: AccountStatus } - java: - { - description: - Gets the status - indicating whether the primary - location of the storage account - is available or unavailable., - name: AccountStatus, - } - protocol: {} - type: SEALED_CHOICE - serializedName: statusOfPrimary - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets the timestamp - of the most recent instance of - a failover to the secondary location. - Only the most recent timestamp - is retained. This element is not - returned if there has never been - a failover instance. Only available - if the accountType is Standard_GRS - or Standard_RAGRS., - name: lastGeoFailoverTime, - } - java: - { - description: - Gets the timestamp - of the most recent instance of - a failover to the secondary location. - Only the most recent timestamp - is retained. This element is not - returned if there has never been - a failover instance. Only available - if the accountType is Standard_GRS - or Standard_RAGRS., - name: lastGeoFailoverTime, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id455 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { description: Gets the - timestamp of the most recent - instance of a failover to the - secondary location. Only the - most recent timestamp is retained. - This element is not returned - if there has never been a failover - instance. Only available if - the accountType is Standard_GRS - or Standard_RAGRS., name: StorageAccountPropertiesLastGeoFailoverTime } - protocol: {} - type: DATE_TIME - serializedName: lastGeoFailoverTime - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets the location - of the geo-replicated secondary - for the storage account. Only - available if the accountType is - Standard_GRS or Standard_RAGRS., - name: secondaryLocation, - } - java: - { - description: - Gets the location - of the geo-replicated secondary - for the storage account. Only - available if the accountType is - Standard_GRS or Standard_RAGRS., - name: secondaryLocation, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id653 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Gets the - location of the geo-replicated - secondary for the storage account. - Only available if the accountType - is Standard_GRS or Standard_RAGRS., name: StorageAccountPropertiesSecondaryLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: secondaryLocation - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the status - indicating whether the secondary - location of the storage account - is available or unavailable. Only - available if the SKU name is Standard_GRS - or Standard_RAGRS., name: statusOfSecondary } - java: - { description: Gets the status - indicating whether the secondary - location of the storage account - is available or unavailable. Only - available if the SKU name is Standard_GRS - or Standard_RAGRS., name: statusOfSecondary } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id016 - serializedName: statusOfSecondary - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets the creation - date and time of the storage account - in UTC., - name: creationTime, - } - java: - { - description: - Gets the creation - date and time of the storage account - in UTC., - name: creationTime, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id456 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { description: Gets the - creation date and time of the - storage account in UTC., name: StorageAccountPropertiesCreationTime } - protocol: {} - type: DATE_TIME - serializedName: creationTime - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the custom - domain the user assigned to this - storage account., name: customDomain } - java: - { description: Gets the custom - domain the user assigned to this - storage account., name: customDomain } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id129 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: The custom - domain assigned to this storage - account. This can be set via - Update., name: CustomDomain, namespace: "" } - java: - { - description: - The custom domain - assigned to this storage account. - This can be set via Update., - name: CustomDomain, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets or - sets the custom domain name - assigned to the storage account. - Name is the CNAME source., name: name } - java: - { - description: - Gets or sets - the custom domain name assigned - to the storage account. Name - is the CNAME source., - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id620 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Gets - or sets the custom domain - name assigned to the storage - account. Name is the CNAME - source., name: CustomDomainName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Indicates - whether indirect CName validation - is enabled. Default value - is false. This should only - be set on updates., name: useSubDomainName } - java: - { description: Indicates - whether indirect CName validation - is enabled. Default value - is false. This should only - be set on updates., name: useSubDomainName } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id395 - apiVersions: [] - language: - default: - { - description: - Indicates - whether indirect CName validation - is enabled. Default value - is false. This should only - be set on updates., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: useSubDomainName - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: customDomain - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Gets the URLs - that are used to perform a retrieval - of a public blob, queue, or table - object from the secondary location - of the storage account. Only available - if the SKU name is Standard_RAGRS.", name: secondaryEndpoints } - java: - { description: "Gets the URLs - that are used to perform a retrieval - of a public blob, queue, or table - object from the secondary location - of the storage account. Only available - if the SKU name is Standard_RAGRS.", name: secondaryEndpoints } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id017 - serializedName: secondaryEndpoints - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "Gets the encryption - settings on the account. If unspecified, - the account is unencrypted.", - name: encryption, - } - java: - { - description: - "Gets the encryption - settings on the account. If unspecified, - the account is unencrypted.", - name: encryption, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id130 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: - The encryption - settings on the storage account., - name: Encryption, - namespace: "", - } - java: - { - description: - The encryption - settings on the storage account., - name: Encryption, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: List of - services which support encryption., name: services } - java: - { - description: - List of services - which support encryption., - name: services, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id512 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { description: A list - of services that support - encryption., name: EncryptionServices, namespace: "" } - java: - { - description: - A list of - services that support encryption., - name: EncryptionServices, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - encryption function of - the blob storage service., name: blob } - java: - { - description: - The encryption - function of the blob storage - service., - name: blob, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id018 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { description: A - service that allows - server-side encryption - to be used., name: EncryptionService, namespace: "" } - java: - { - description: - A service - that allows server-side - encryption to be used., - name: EncryptionService, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - A - boolean indicating - whether or not the - service encrypts the - data as it is stored., - name: enabled, - } - java: - { - description: - A - boolean indicating - whether or not the - service encrypts the - data as it is stored., - name: enabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id396 - apiVersions: - [] - language: - default: - { - description: - A - boolean indicating - whether or not the - service encrypts - the data as it is - stored., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: enabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "Gets - a rough estimate of - the date/time when - the encryption was - last enabled by the - user. Only returned - when encryption is - enabled. There might - be some unencrypted - blobs which were written - after this time, as - it is just a rough - estimate.", - name: lastEnabledTime, - } - java: - { - description: - "Gets - a rough estimate of - the date/time when - the encryption was - last enabled by the - user. Only returned - when encryption is - enabled. There might - be some unencrypted - blobs which were written - after this time, as - it is just a rough - estimate.", - name: lastEnabledTime, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id453 - apiVersions: - - { - version: "2021-01-01", - } - format: DATE_TIME - language: - default: - { - description: - "Gets - a rough estimate - of the date/time - when the encryption - was last enabled - by the user. Only - returned when encryption - is enabled. There - might be some unencrypted - blobs which were - written after this - time, as it is just - a rough estimate.", - name: EncryptionServiceLastEnabledTime, - } - protocol: {} - type: DATE_TIME - serializedName: lastEnabledTime - - apiVersions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [ - create, - read, - ] - xmsSkipUrlEncoding: false - isDiscriminator: false - language: - default: - { - description: - Encryption - key type to be used - for the encryption - service. 'Account' - key type implies that - an account-scoped - encryption key will - be used. 'Service' - key type implies that - a default service - key is used., - name: keyType, - } - java: - { - description: - Encryption - key type to be used - for the encryption - service. 'Account' - key type implies that - an account-scoped - encryption key will - be used. 'Service' - key type implies that - a default service - key is used., - name: keyType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id423 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: SERVICE, - } - value: Service - - language: - default: - { - description: "", - name: ACCOUNT, - } - value: Account - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: - [ - create, - read, - ] - xmsSkipUrlEncoding: false - language: - default: - { - description: - Encryption - key type to be used - for the encryption - service. 'Account' - key type implies - that an account-scoped - encryption key will - be used. 'Service' - key type implies - that a default service - key is used., - name: KeyType, - } - java: - { - description: - Encryption - key type to be used - for the encryption - service. 'Account' - key type implies - that an account-scoped - encryption key will - be used. 'Service' - key type implies - that a default service - key is used., - name: KeyType, - } - protocol: {} - type: CHOICE - serializedName: keyType - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: blob - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - encryption function of - the file storage service., name: file } - java: - { - description: - The encryption - function of the file storage - service., - name: file, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: file - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - encryption function of - the table storage service., name: table } - java: - { - description: - The encryption - function of the table - storage service., - name: table, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: table - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - encryption function of - the queue storage service., name: queue } - java: - { - description: - The encryption - function of the queue - storage service., - name: queue, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id018 - serializedName: queue - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: services - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The encryption - keySource (provider). Possible - values (case-insensitive): Microsoft.Storage, - Microsoft.Keyvault", - name: keySource, - } - java: - { - description: - "The encryption - keySource (provider). Possible - values (case-insensitive): Microsoft.Storage, - Microsoft.Keyvault", - name: keySource, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id424 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: MICROSOFT_STORAGE, - } - value: Microsoft.Storage - - language: - default: - { - description: "", - name: MICROSOFT_KEYVAULT, - } - value: Microsoft.Keyvault - defaultValue: Microsoft.Storage - language: - default: - { description: "The - encryption keySource (provider). - Possible values (case-insensitive): Microsoft.Storage, - Microsoft.Keyvault", name: KeySource } - java: - { - description: - "The encryption - keySource (provider). Possible - values (case-insensitive): Microsoft.Storage, - Microsoft.Keyvault", - name: KeySource, - } - protocol: {} - type: CHOICE - serializedName: keySource - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A boolean - indicating whether or not - the service applies a secondary - layer of encryption with platform - managed keys for data at rest., name: requireInfrastructureEncryption } - java: - { description: A boolean - indicating whether or not - the service applies a secondary - layer of encryption with platform - managed keys for data at rest., name: requireInfrastructureEncryption } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id397 - apiVersions: [] - language: - default: - { - description: - A boolean - indicating whether or not - the service applies a secondary - layer of encryption with - platform managed keys for - data at rest., - name: RequireInfrastructureEncryption, - } - protocol: {} - type: BOOLEAN - serializedName: requireInfrastructureEncryption - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Properties - provided by key vault., - name: keyVaultProperties, - } - java: - { - description: - Properties - provided by key vault., - name: keyVaultProperties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id513 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - Properties - of key vault., - name: KeyVaultProperties, - namespace: "", - } - java: - { - description: - Properties - of key vault., - name: KeyVaultProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - name of KeyVault key., name: keyName } - java: - { - description: - The name - of KeyVault key., - name: keyName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id621 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - The - name of KeyVault key., - name: KeyVaultPropertiesKeyname, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyname - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - version of KeyVault key., name: keyVersion } - java: - { - description: - The version - of KeyVault key., - name: keyVersion, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id622 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - The - version of KeyVault - key., - name: KeyVaultPropertiesKeyversion, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyversion - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - Uri of KeyVault., name: keyVaultUri } - java: - { - description: - The Uri - of KeyVault., - name: keyVaultUri, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id623 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - The - Uri of KeyVault., - name: KeyVaultPropertiesKeyvaulturi, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyvaulturi - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The - object identifier of the - current versioned Key - Vault Key in use., name: currentVersionedKeyIdentifier } - java: - { - description: - The object - identifier of the current - versioned Key Vault Key - in use., - name: currentVersionedKeyIdentifier, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id624 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - The - object identifier of - the current versioned - Key Vault Key in use., - name: KeyVaultPropertiesCurrentVersionedKeyIdentifier, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: currentVersionedKeyIdentifier - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Timestamp - of last rotation of the - Key Vault Key., - name: lastKeyRotationTimestamp, - } - java: - { - description: - Timestamp - of last rotation of the - Key Vault Key., - name: lastKeyRotationTimestamp, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id454 - apiVersions: - - { - version: "2021-01-01", - } - format: DATE_TIME - language: - default: - { - description: - Timestamp - of last rotation of - the Key Vault Key., - name: KeyVaultPropertiesLastKeyRotationTimestamp, - } - protocol: {} - type: DATE_TIME - serializedName: lastKeyRotationTimestamp - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: keyvaultproperties - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The identity - to be used with service-side - encryption at rest., - name: encryptionIdentity, - } - java: - { - description: - The identity - to be used with service-side - encryption at rest., - name: encryptionIdentity, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id514 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - Encryption - identity for the storage - account., - name: EncryptionIdentity, - namespace: "", - } - java: - { - description: - Encryption - identity for the storage - account., - name: EncryptionIdentity, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Resource - identifier of the UserAssigned - identity to be associated - with server-side encryption - on the storage account., - name: encryptionUserAssignedIdentity, - } - java: - { - description: - Resource - identifier of the UserAssigned - identity to be associated - with server-side encryption - on the storage account., - name: encryptionUserAssignedIdentity, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id625 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Resource - identifier of the UserAssigned - identity to be associated - with server-side encryption - on the storage account., - name: EncryptionIdentityUserAssignedIdentity, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: userAssignedIdentity - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: identity - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: encryption - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Required for - storage accounts where kind = - BlobStorage. The access tier used - for billing., name: accessTier } - java: - { - description: - Required for storage - accounts where kind = BlobStorage. - The access tier used for billing., - name: accessTier, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id132 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: HOT, - } - value: Hot - - language: - default: - { - description: "", - name: COOL, - } - value: Cool - language: - default: - { description: Required - for storage accounts where kind - = BlobStorage. The access tier - used for billing., name: AccessTier } - java: - { description: Required for - storage accounts where kind - = BlobStorage. The access tier - used for billing., name: AccessTier } - protocol: {} - type: SEALED_CHOICE - serializedName: accessTier - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Provides the - identity based authentication - settings for Azure Files., name: azureFilesIdentityBasedAuthentication } - java: - { - description: - Provides the identity - based authentication settings - for Azure Files., - name: azureFilesIdentityBasedAuthentication, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id133 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Settings - for Azure Files identity based - authentication., name: AzureFilesIdentityBasedAuthentication, namespace: "" } - java: - { description: Settings for - Azure Files identity based authentication., name: AzureFilesIdentityBasedAuthentication } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Indicates - the directory service used., name: directoryServiceOptions } - java: - { description: Indicates - the directory service used., name: directoryServiceOptions } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id427 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: NONE, - } - value: None - - language: - default: - { - description: "", - name: AADDS, - } - value: AADDS - - language: - default: - { - description: "", - name: AD, - } - value: AD - language: - default: - { - description: - Indicates - the directory service used., - name: DirectoryServiceOptions, - } - java: - { - description: - Indicates - the directory service used., - name: DirectoryServiceOptions, - } - protocol: {} - type: CHOICE - serializedName: directoryServiceOptions - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Required - if choose AD., name: activeDirectoryProperties } - java: - { - description: - Required if - choose AD., - name: activeDirectoryProperties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id518 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - Settings - properties for Active Directory - (AD)., - name: ActiveDirectoryProperties, - namespace: "", - } - java: - { - description: - Settings - properties for Active Directory - (AD)., - name: ActiveDirectoryProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Specifies - the primary domain that - the AD DNS server is authoritative - for., - name: domainName, - } - java: - { - description: - Specifies - the primary domain that - the AD DNS server is authoritative - for., - name: domainName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id630 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Specifies - the primary domain that - the AD DNS server is - authoritative for., - name: ActiveDirectoryPropertiesDomainName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: domainName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Specifies - the NetBIOS domain name., - name: netBiosDomainName, - } - java: - { - description: - Specifies - the NetBIOS domain name., - name: netBiosDomainName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id631 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Specifies - the NetBIOS domain name., - name: ActiveDirectoryPropertiesNetBiosDomainName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: netBiosDomainName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Specifies - the Active Directory forest - to get., - name: forestName, - } - java: - { - description: - Specifies - the Active Directory forest - to get., - name: forestName, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id632 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Specifies - the Active Directory - forest to get., - name: ActiveDirectoryPropertiesForestName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: forestName - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Specifies - the domain GUID., - name: domainGuid, - } - java: - { - description: - Specifies - the domain GUID., - name: domainGuid, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id633 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Specifies - the domain GUID., - name: ActiveDirectoryPropertiesDomainGuid, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: domainGuid - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Specifies - the security identifier - (SID)., - name: domainSid, - } - java: - { - description: - Specifies - the security identifier - (SID)., - name: domainSid, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id634 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Specifies - the security identifier - (SID)., - name: ActiveDirectoryPropertiesDomainSid, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: domainSid - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Specifies - the security identifier - (SID) for Azure Storage., - name: azureStorageSid, - } - java: - { - description: - Specifies - the security identifier - (SID) for Azure Storage., - name: azureStorageSid, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id635 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Specifies - the security identifier - (SID) for Azure Storage., - name: ActiveDirectoryPropertiesAzureStorageSid, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: azureStorageSid - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: activeDirectoryProperties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: azureFilesIdentityBasedAuthentication - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Allows https - traffic only to storage service - if sets to true., name: enableHttpsTrafficOnly } - java: - { - description: - Allows https traffic - only to storage service if sets - to true., - name: enableHttpsTrafficOnly, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id153 - apiVersions: [] - language: - default: - { description: Allows https - traffic only to storage service - if sets to true., name: EnableHttpsTrafficOnly } - protocol: {} - type: BOOLEAN - serializedName: supportsHttpsTrafficOnly - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Network rule - set, name: networkRuleSet } - java: - { - description: Network rule set, - name: networkRuleSet, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id131 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Network rule - set, name: NetworkRuleSet, namespace: "" } - java: - { description: Network rule - set, name: NetworkRuleSet } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - 'Specifies - whether traffic is bypassed - for Logging/Metrics/AzureServices. - Possible values are any combination - of Logging|Metrics|AzureServices - (For example, "Logging, Metrics"), - or None to bypass none of - those traffics.', - name: bypass, - } - java: - { - description: - 'Specifies - whether traffic is bypassed - for Logging/Metrics/AzureServices. - Possible values are any combination - of Logging|Metrics|AzureServices - (For example, "Logging, Metrics"), - or None to bypass none of - those traffics.', - name: bypass, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id425 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: NONE, - } - value: None - - language: - default: - { - description: "", - name: LOGGING, - } - value: Logging - - language: - default: - { - description: "", - name: METRICS, - } - value: Metrics - - language: - default: - { - description: "", - name: AZURE_SERVICES, - } - value: AzureServices - defaultValue: AzureServices - language: - default: - { - description: - 'Specifies - whether traffic is bypassed - for Logging/Metrics/AzureServices. - Possible values are any - combination of Logging|Metrics|AzureServices - (For example, "Logging, - Metrics"), or None to bypass - none of those traffics.', - name: Bypass, - } - java: - { - description: - 'Specifies - whether traffic is bypassed - for Logging/Metrics/AzureServices. - Possible values are any - combination of Logging|Metrics|AzureServices - (For example, "Logging, - Metrics"), or None to bypass - none of those traffics.', - name: Bypass, - } - protocol: {} - type: CHOICE - serializedName: bypass - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Sets the - resource access rules, name: resourceAccessRules } - java: - { - description: - Sets the resource - access rules, - name: resourceAccessRules, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id357 - apiVersions: - - { - version: "2021-01-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id515 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - Resource - Access Rule., - name: ResourceAccessRule, - namespace: "", - } - java: - { - description: - Resource - Access Rule., - name: ResourceAccessRule, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Tenant - Id, - name: tenantId, - } - java: - { - description: - Tenant - Id, - name: tenantId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id626 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Tenant - Id, - name: ResourceAccessRuleTenantId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: tenantId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Resource - Id, - name: resourceId, - } - java: - { - description: - Resource - Id, - name: resourceId, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id627 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Resource - Id, - name: ResourceAccessRuleResourceId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resourceId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: Sets - the resource access rules, name: NetworkRuleSetResourceAccessRules } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: resourceAccessRules - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Sets the - virtual network rules, name: virtualNetworkRules } - java: - { - description: - Sets the virtual - network rules, - name: virtualNetworkRules, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id358 - apiVersions: - - { - version: "2021-01-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id516 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - Virtual - Network rule., - name: VirtualNetworkRule, - namespace: "", - } - java: - { - description: - Virtual - Network rule., - name: VirtualNetworkRule, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "Resource - ID of a subnet, for - example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}.", - name: virtualNetworkResourceId, - } - java: - { - description: - "Resource - ID of a subnet, for - example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}.", - name: virtualNetworkResourceId, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id628 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - "Resource - ID of a subnet, for - example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}.", - name: VirtualNetworkRuleId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The - action of virtual network - rule., - name: action, - } - java: - { - description: - The - action of virtual network - rule., - name: action, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id019 - apiVersions: [] - choiceType: *id010 - choices: - - { - value: Allow, - } - language: &id451 - default: - { - description: - The - action of virtual - network rule., - name: Action, - } - java: - { - description: - The - action of virtual - network rule., - name: Action, - } - type: SEALED_CHOICE - serializedName: action - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Gets - the state of virtual - network rule., - name: state, - } - java: - { - description: - Gets - the state of virtual - network rule., - name: state, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id426 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: PROVISIONING, - } - value: provisioning - - language: - default: - { - description: "", - name: DEPROVISIONING, - } - value: deprovisioning - - language: - default: - { - description: "", - name: SUCCEEDED, - } - value: succeeded - - language: - default: - { - description: "", - name: FAILED, - } - value: failed - - language: - default: - { - description: "", - name: NETWORK_SOURCE_DELETED, - } - value: networkSourceDeleted - language: - default: - { - description: - Gets - the state of virtual - network rule., - name: State, - } - java: - { - description: - Gets - the state of virtual - network rule., - name: State, - } - protocol: {} - type: CHOICE - serializedName: state - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: Sets - the virtual network rules, name: NetworkRuleSetVirtualNetworkRules } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: virtualNetworkRules - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Sets the - IP ACL rules, name: IpRules } - java: - { - description: - Sets the IP - ACL rules, - name: ipRules, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id359 - apiVersions: - - { - version: "2021-01-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id517 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { description: IP - rule with specific IP - or IP range in CIDR format., name: IpRule, namespace: "" } - java: - { - description: - IP rule - with specific IP or IP - range in CIDR format., - name: IpRule, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Specifies - the IP or IP range in - CIDR format. Only IPV4 - address is allowed., - name: IpAddressOrRange, - } - java: - { - description: - Specifies - the IP or IP range in - CIDR format. Only IPV4 - address is allowed., - name: ipAddressOrRange, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id629 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Specifies - the IP or IP range - in CIDR format. Only - IPV4 address is allowed., - name: IpRuleValue, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The - action of IP ACL rule., - name: action, - } - java: - { - description: - The - action of IP ACL rule., - name: action, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id019 - serializedName: action - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: Sets - the IP ACL rules, name: NetworkRuleSetIpRules } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: ipRules - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Specifies - the default action of allow - or deny when no other rules - match., name: defaultAction } - java: - { description: Specifies - the default action of allow - or deny when no other rules - match., name: defaultAction } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id583 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: ALLOW, - } - value: Allow - - language: - default: - { - description: "", - name: DENY, - } - value: Deny - defaultValue: Allow - language: - default: - { - description: - Specifies - the default action of allow - or deny when no other rules - match., - name: DefaultAction, - } - java: - { - description: - Specifies - the default action of allow - or deny when no other rules - match., - name: DefaultAction, - } - protocol: {} - type: SEALED_CHOICE - serializedName: defaultAction - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: networkAcls - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Account HierarchicalNamespace - enabled if sets to true., - name: IsHnsEnabled, - } - java: - { - description: - Account HierarchicalNamespace - enabled if sets to true., - name: isHnsEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id134 - apiVersions: [] - language: - default: - { - description: - Account HierarchicalNamespace - enabled if sets to true., - name: IsHnsEnabled, - } - protocol: {} - type: BOOLEAN - serializedName: isHnsEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Geo Replication - Stats, name: geoReplicationStats } - java: - { description: Geo Replication - Stats, name: geoReplicationStats } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id522 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: "Statistics - related to replication for storage - account's Blob, Table, Queue - and File services. It is only - available when geo-redundant - replication is enabled for the - storage account.", name: GeoReplicationStats, namespace: "" } - java: - { description: "Statistics - related to replication for storage - account's Blob, Table, Queue - and File services. It is only - available when geo-redundant - replication is enabled for the - storage account.", name: GeoReplicationStats } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The status - of the secondary location. - Possible values are: - Live: - Indicates that the secondary - location is active and operational. - - Bootstrap: Indicates initial - synchronization from the primary - location to the secondary - location is in progress.This - typically occurs when replication - is first enabled. - Unavailable: - Indicates that the secondary - location is temporarily unavailable.", - name: status, - } - java: - { - description: - "The status - of the secondary location. - Possible values are: - Live: - Indicates that the secondary - location is active and operational. - - Bootstrap: Indicates initial - synchronization from the primary - location to the secondary - location is in progress.This - typically occurs when replication - is first enabled. - Unavailable: - Indicates that the secondary - location is temporarily unavailable.", - name: status, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id429 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: LIVE, - } - value: Live - - language: - default: - { - description: "", - name: BOOTSTRAP, - } - value: Bootstrap - - language: - default: - { - description: "", - name: UNAVAILABLE, - } - value: Unavailable - language: - default: - { description: "The - status of the secondary - location. Possible values - are: - Live: Indicates that - the secondary location is - active and operational. - - Bootstrap: Indicates initial - synchronization from the - primary location to the - secondary location is in - progress.This typically - occurs when replication - is first enabled. - Unavailable: - Indicates that the secondary - location is temporarily - unavailable.", name: GeoReplicationStatus } - java: - { - description: - "The status - of the secondary location. - Possible values are: - Live: - Indicates that the secondary - location is active and operational. - - Bootstrap: Indicates initial - synchronization from the - primary location to the - secondary location is in - progress.This typically - occurs when replication - is first enabled. - Unavailable: - Indicates that the secondary - location is temporarily - unavailable.", - name: GeoReplicationStatus, - } - protocol: {} - type: CHOICE - serializedName: status - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "All primary - writes preceding this UTC - date/time value are guaranteed - to be available for read operations. - Primary writes following this - point in time may or may not - be available for reads. Element - may be default value if value - of LastSyncTime is not available, - this can happen if secondary - is offline or we are in bootstrap.", - name: lastSyncTime, - } - java: - { - description: - "All primary - writes preceding this UTC - date/time value are guaranteed - to be available for read operations. - Primary writes following this - point in time may or may not - be available for reads. Element - may be default value if value - of LastSyncTime is not available, - this can happen if secondary - is offline or we are in bootstrap.", - name: lastSyncTime, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id457 - apiVersions: - - { - version: "2021-01-01", - } - format: DATE_TIME - language: - default: - { description: "All - primary writes preceding - this UTC date/time value - are guaranteed to be available - for read operations. Primary - writes following this point - in time may or may not be - available for reads. Element - may be default value if - value of LastSyncTime is - not available, this can - happen if secondary is offline - or we are in bootstrap.", name: GeoReplicationStatsLastSyncTime } - protocol: {} - type: DATE_TIME - serializedName: lastSyncTime - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A boolean - flag which indicates whether - or not account failover is - supported for the account., name: canFailover } - java: - { description: A boolean - flag which indicates whether - or not account failover is - supported for the account., name: canFailover } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id401 - apiVersions: [] - language: - default: - { - description: - A boolean - flag which indicates whether - or not account failover - is supported for the account., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: canFailover - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: geoReplicationStats - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "If the failover - is in progress, the value will - be true, otherwise, it will be - null.", - name: failoverInProgress, - } - java: - { - description: - "If the failover - is in progress, the value will - be true, otherwise, it will be - null.", - name: failoverInProgress, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id402 - apiVersions: [] - language: - default: - { - description: - "If the failover - is in progress, the value will - be true, otherwise, it will - be null.", - name: FailoverInProgress, - } - protocol: {} - type: BOOLEAN - serializedName: failoverInProgress - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Allow large - file shares if sets to Enabled. - It cannot be disabled once it - is enabled., name: largeFileSharesState } - java: - { - description: - Allow large file - shares if sets to Enabled. It - cannot be disabled once it is - enabled., - name: largeFileSharesState, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id135 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: DISABLED, - } - value: Disabled - - language: - default: - { - description: "", - name: ENABLED, - } - value: Enabled - language: - default: - { description: Allow large - file shares if sets to Enabled. - It cannot be disabled once it - is enabled., name: LargeFileSharesState } - java: - { description: Allow large - file shares if sets to Enabled. - It cannot be disabled once it - is enabled., name: LargeFileSharesState } - protocol: {} - type: CHOICE - serializedName: largeFileSharesState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: List of private - endpoint connection associated - with the specified storage account, name: privateEndpointConnections } - java: - { description: List of private - endpoint connection associated - with the specified storage account, name: privateEndpointConnections } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id360 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id268 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: The Private - Endpoint Connection resource., name: PrivateEndpointConnection, namespace: "" } - java: - { description: The Private - Endpoint Connection resource., name: PrivateEndpointConnection } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id020 - apiVersions: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - java: - { - name: ProxyResource, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: &id022 - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: - the - fully qualified resource - ID for the resource, - name: id, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: - the - name of the resource, - name: name, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - java: - { - description: - the - type of the resource, - name: type, - } - nullable: false - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - serializedName: type - stronglyTypedHeader: false - immediate: - - *id020 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: - Resource - properties., - name: properties, - } - java: - { - description: - Resource - properties., - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id523 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: true - language: - default: - { - description: - Properties - of the PrivateEndpointConnectProperties., - name: PrivateEndpointConnectionProperties, - namespace: "", - } - java: - { - description: - Properties - of the PrivateEndpointConnectProperties., - name: PrivateEndpointConnectionProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The - resource of private - end point., - name: privateEndpoint, - } - java: - { - description: - The - resource of private - end point., - name: privateEndpoint, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id524 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - The - Private Endpoint resource., - name: PrivateEndpoint, - namespace: "", - } - java: - { - description: - The - Private Endpoint resource., - name: PrivateEndpoint, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - The - ARM identifier for - Private Endpoint, - name: Id, - } - java: - { - description: - The - ARM identifier for - Private Endpoint, - name: id, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id654 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - The - ARM identifier - for Private Endpoint, - name: PrivateEndpointId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: privateEndpoint - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A - collection of information - about the state of the - connection between service - consumer and provider., name: privateLinkServiceConnectionState } - java: - { - description: - A collection - of information about - the state of the connection - between service consumer - and provider., - name: privateLinkServiceConnectionState, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id525 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - A - collection of information - about the state of - the connection between - service consumer and - provider., - name: PrivateLinkServiceConnectionState, - namespace: "", - } - java: - { - description: - A - collection of information - about the state of - the connection between - service consumer and - provider., - name: PrivateLinkServiceConnectionState, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - Indicates - whether the connection - has been Approved/Rejected/Removed - by the owner of - the service., - name: status, - } - java: - { - description: - Indicates - whether the connection - has been Approved/Rejected/Removed - by the owner of - the service., - name: status, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id430 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: PENDING, - } - value: Pending - - language: - default: - { - description: "", - name: APPROVED, - } - value: Approved - - language: - default: - { - description: "", - name: REJECTED, - } - value: Rejected - language: - default: - { - description: - The - private endpoint - connection status., - name: PrivateEndpointServiceConnectionStatus, - } - java: - { - description: - The - private endpoint - connection status., - name: PrivateEndpointServiceConnectionStatus, - } - protocol: {} - type: CHOICE - serializedName: status - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - The - reason for approval/rejection - of the connection., - name: description, - } - java: - { - description: - The - reason for approval/rejection - of the connection., - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id655 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - The - reason for approval/rejection - of the connection., - name: PrivateLinkServiceConnectionStateDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - A - message indicating - if changes on the - service provider - require any updates - on the consumer., - name: actionRequired, - } - java: - { - description: - A - message indicating - if changes on the - service provider - require any updates - on the consumer., - name: actionRequired, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id656 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - A - message indicating - if changes on - the service provider - require any updates - on the consumer., - name: PrivateLinkServiceConnectionStateActionRequired, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: actionRequired - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: privateLinkServiceConnectionState - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The - provisioning state of - the private endpoint - connection resource., - name: provisioningState, - } - java: - { - description: - The - provisioning state of - the private endpoint - connection resource., - name: provisioningState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id431 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: SUCCEEDED, - } - value: Succeeded - - language: - default: - { - description: "", - name: CREATING, - } - value: Creating - - language: - default: - { - description: "", - name: DELETING, - } - value: Deleting - - language: - default: - { - description: "", - name: FAILED, - } - value: Failed - language: - default: - { - description: - The - current provisioning - state., - name: PrivateEndpointConnectionProvisioningState, - } - java: - { - description: - The - current provisioning - state., - name: PrivateEndpointConnectionProvisioningState, - } - protocol: {} - type: CHOICE - serializedName: provisioningState - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { - description: - List of private - endpoint connection associated - with the specified storage account, - name: StorageAccountPropertiesPrivateEndpointConnections, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: privateEndpointConnections - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Maintains information - about the network routing choice - opted by the user for data transfer, - name: routingPreference, - } - java: - { - description: - Maintains information - about the network routing choice - opted by the user for data transfer, - name: routingPreference, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id136 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: "Routing - preference defines the type - of network, either microsoft - or internet routing to be used - to deliver the user data, the - default option is microsoft - routing", name: RoutingPreference, namespace: "" } - java: - { - description: - "Routing preference - defines the type of network, - either microsoft or internet - routing to be used to deliver - the user data, the default option - is microsoft routing", - name: RoutingPreference, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Routing - Choice defines the kind of - network routing opted by the - user., name: routingChoice } - java: - { - description: - Routing Choice - defines the kind of network - routing opted by the user., - name: routingChoice, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id428 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: MICROSOFT_ROUTING, - } - value: MicrosoftRouting - - language: - default: - { - description: "", - name: INTERNET_ROUTING, - } - value: InternetRouting - language: - default: - { description: Routing - Choice defines the kind - of network routing opted - by the user., name: RoutingChoice } - java: - { description: Routing - Choice defines the kind - of network routing opted - by the user., name: RoutingChoice } - protocol: {} - type: CHOICE - serializedName: routingChoice - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A boolean - flag which indicates whether - microsoft routing storage - endpoints are to be published, name: publishMicrosoftEndpoints } - java: - { description: A boolean - flag which indicates whether - microsoft routing storage - endpoints are to be published, name: publishMicrosoftEndpoints } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id399 - apiVersions: [] - language: - default: - { - description: - A boolean - flag which indicates whether - microsoft routing storage - endpoints are to be published, - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: publishMicrosoftEndpoints - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A boolean - flag which indicates whether - internet routing storage endpoints - are to be published, name: publishInternetEndpoints } - java: - { description: A boolean - flag which indicates whether - internet routing storage endpoints - are to be published, name: publishInternetEndpoints } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id400 - apiVersions: [] - language: - default: - { - description: - A boolean - flag which indicates whether - internet routing storage - endpoints are to be published, - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: publishInternetEndpoints - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: routingPreference - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Blob restore - status, name: blobRestoreStatus } - java: - { - description: Blob restore status, - name: blobRestoreStatus, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id204 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Blob restore - status., name: BlobRestoreStatus, namespace: "" } - java: - { description: Blob restore - status., name: BlobRestoreStatus } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The status - of blob restore progress. - Possible values are: - InProgress: - Indicates that blob restore - is ongoing. - Complete: Indicates - that blob restore has been - completed successfully. - - Failed: Indicates that blob - restore is failed.", - name: status, - } - java: - { - description: - "The status - of blob restore progress. - Possible values are: - InProgress: - Indicates that blob restore - is ongoing. - Complete: Indicates - that blob restore has been - completed successfully. - - Failed: Indicates that blob - restore is failed.", - name: status, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id432 - apiVersions: - - { - version: "2021-01-01", - } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: IN_PROGRESS, - } - value: InProgress - - language: - default: - { - description: "", - name: COMPLETE, - } - value: Complete - - language: - default: - { - description: "", - name: FAILED, - } - value: Failed - language: - default: - { description: "The - status of blob restore progress. - Possible values are: - InProgress: - Indicates that blob restore - is ongoing. - Complete: - Indicates that blob restore - has been completed successfully. - - Failed: Indicates that - blob restore is failed.", name: BlobRestoreProgressStatus } - java: - { - description: - "The status - of blob restore progress. - Possible values are: - InProgress: - Indicates that blob restore - is ongoing. - Complete: - Indicates that blob restore - has been completed successfully. - - Failed: Indicates that - blob restore is failed.", - name: BlobRestoreProgressStatus, - } - protocol: {} - type: CHOICE - serializedName: status - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Failure - reason when blob restore is - failed., name: failureReason } - java: - { - description: - Failure reason - when blob restore is failed., - name: failureReason, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id660 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Failure - reason when blob restore - is failed., name: BlobRestoreStatusFailureReason } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: failureReason - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Id for - tracking blob restore request., name: restoreId } - java: - { - description: - Id for tracking - blob restore request., - name: restoreId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id661 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { description: Id for - tracking blob restore request., name: BlobRestoreStatusRestoreId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: restoreId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Blob restore - request parameters., - name: parameters, - } - java: - { - description: - Blob restore - request parameters., - name: parameters, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id202 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { description: Blob - restore parameters, name: BlobRestoreParameters, namespace: "" } - java: - { - description: - Blob restore - parameters, - name: BlobRestoreParameters, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Restore - blob to the specified - time., - name: timeToRestore, - } - java: - { - description: - Restore - blob to the specified - time., - name: timeToRestore, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id458 - apiVersions: - - { - version: "2021-01-01", - } - format: DATE_TIME - language: - default: - { - description: - Restore - blob to the specified - time., - name: BlobRestoreParametersTimeToRestore, - } - protocol: {} - type: DATE_TIME - serializedName: timeToRestore - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Blob - ranges to restore., - name: blobRanges, - } - java: - { - description: - Blob ranges - to restore., - name: blobRanges, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id361 - apiVersions: - - { - version: "2021-01-01", - } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id526 - apiVersions: - - { - version: "2021-01-01", - } - flattenedSchema: false - language: - default: - { - description: - Blob - range, - name: BlobRestoreRange, - namespace: "", - } - java: - { - description: - Blob - range, - name: BlobRestoreRange, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - Blob - start range. This - is inclusive. Empty - means account start., - name: startRange, - } - java: - { - description: - Blob - start range. This - is inclusive. Empty - means account start., - name: startRange, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id662 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Blob - start range. This - is inclusive. - Empty means account - start., - name: BlobRestoreRangeStartRange, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: startRange - - apiVersions: - [] - isDiscriminator: false - language: - default: - { - description: - Blob - end range. This - is exclusive. Empty - means account end., - name: endRange, - } - java: - { - description: - Blob - end range. This - is exclusive. Empty - means account end., - name: endRange, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id663 - apiVersions: - - { - version: "2021-01-01", - } - language: - default: - { - description: - Blob - end range. This - is exclusive. - Empty means account - end., - name: BlobRestoreRangeEndRange, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: endRange - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { - description: - Blob - ranges to restore., - name: BlobRestoreParametersBlobRanges, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: blobRanges - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: parameters - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: blobRestoreStatus - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Allow or disallow - public access to all blobs or - containers in the storage account. - The default interpretation is - true for this property., - name: allowBlobPublicAccess, - } - java: - { - description: - Allow or disallow - public access to all blobs or - containers in the storage account. - The default interpretation is - true for this property., - name: allowBlobPublicAccess, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id137 - apiVersions: [] - language: - default: - { description: Allow or - disallow public access to all - blobs or containers in the storage - account. The default interpretation - is true for this property., name: AllowBlobPublicAccess } - protocol: {} - type: BOOLEAN - serializedName: allowBlobPublicAccess - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Set the minimum - TLS version to be permitted on - requests to storage. The default - interpretation is TLS 1.0 for - this property., name: minimumTlsVersion } - java: - { description: Set the minimum - TLS version to be permitted on - requests to storage. The default - interpretation is TLS 1.0 for - this property., name: minimumTlsVersion } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id138 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: TLS1_0, - } - value: TLS1_0 - - language: - default: - { - description: "", - name: TLS1_1, - } - value: TLS1_1 - - language: - default: - { - description: "", - name: TLS1_2, - } - value: TLS1_2 - language: - default: - { - description: - Set the minimum - TLS version to be permitted - on requests to storage. The - default interpretation is TLS - 1.0 for this property., - name: MinimumTlsVersion, - } - java: - { - description: - Set the minimum - TLS version to be permitted - on requests to storage. The - default interpretation is TLS - 1.0 for this property., - name: MinimumTlsVersion, - } - protocol: {} - type: CHOICE - serializedName: minimumTlsVersion - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Indicates - whether the storage account permits - requests to be authorized with - the account access key via Shared - Key. If false, then all requests, - including shared access signatures, - must be authorized with Azure - Active Directory (Azure AD). The - default value is null, which is - equivalent to true.", name: allowSharedKeyAccess } - java: - { - description: - "Indicates whether - the storage account permits requests - to be authorized with the account - access key via Shared Key. If - false, then all requests, including - shared access signatures, must - be authorized with Azure Active - Directory (Azure AD). The default - value is null, which is equivalent - to true.", - name: allowSharedKeyAccess, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id139 - apiVersions: [] - language: - default: - { description: "Indicates - whether the storage account - permits requests to be authorized - with the account access key - via Shared Key. If false, then - all requests, including shared - access signatures, must be authorized - with Azure Active Directory - (Azure AD). The default value - is null, which is equivalent - to true.", name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: allowSharedKeyAccess - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - NFS 3.0 protocol - support enabled if set to true., - name: enableNfsV3, - } - java: - { - description: - NFS 3.0 protocol - support enabled if set to true., - name: enableNfsV3, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id140 - apiVersions: [] - language: - default: - { - description: - NFS 3.0 protocol - support enabled if set to true., - name: EnableNfsV3, - } - protocol: {} - type: BOOLEAN - serializedName: isNfsV3Enabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id021 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Deleted storage account, - name: DeletedAccount, - namespace: "", - } - java: - { - description: Deleted storage account, - name: DeletedAccount, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id023 - apiVersions: - - { version: "1.0" } - children: - all: - - *id021 - immediate: - - *id021 - flattenedSchema: false - language: - default: { description: The resource - model definition for a Azure Resource - Manager proxy resource. It will - not have tags and a location, name: ProxyResource, namespace: "", summary: Proxy Resource } - java: - { description: The resource model - definition for a Azure Resource - Manager proxy resource. It will - not have tags and a location, name: ProxyResource } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: [] - immediate: [] - properties: *id022 - protocol: {} - stronglyTypedHeader: false - summary: Proxy Resource - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id014 - - *id020 - immediate: - - *id023 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { description: Properties of the - deleted account., name: properties } - java: { description: Properties of the - deleted account., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id530 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { description: Attributes of - a deleted storage account., name: DeletedAccountProperties, namespace: "" } - java: { description: Attributes of a - deleted storage account., name: DeletedAccountProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Full resource - id of the original storage account., name: storageAccountResourceId } - java: - { description: Full resource - id of the original storage account., name: storageAccountResourceId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id664 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Full resource - id of the original storage account., name: DeletedAccountPropertiesStorageAccountResourceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: storageAccountResourceId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Location of - the deleted account., name: location } - java: - { description: Location of the - deleted account., name: location } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id665 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Location - of the deleted account., name: DeletedAccountPropertiesLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: location - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Can be used - to attempt recovering this deleted - account via PutStorageAccount - API., name: restoreReference } - java: - { description: Can be used to - attempt recovering this deleted - account via PutStorageAccount - API., name: restoreReference } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id666 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Can be used - to attempt recovering this deleted - account via PutStorageAccount - API., name: DeletedAccountPropertiesRestoreReference } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: restoreReference - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Creation time - of the deleted account., name: creationTime } - java: - { description: Creation time - of the deleted account., name: creationTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id667 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Creation - time of the deleted account., name: DeletedAccountPropertiesCreationTime } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: creationTime - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Deletion time - of the deleted account., name: deletionTime } - java: - { description: Deletion time - of the deleted account., name: deletionTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id668 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Deletion - time of the deleted account., name: DeletedAccountPropertiesDeletionTime } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: deletionTime - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id012 - - *id024 - - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id027 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: "The ImmutabilityPolicy - property of a blob container, including - Id, resource name, resource type, Etag.", name: ImmutabilityPolicy, namespace: "" } - java: - { description: "The ImmutabilityPolicy - property of a blob container, including - Id, resource name, resource type, Etag.", name: ImmutabilityPolicy } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id013 - - *id014 - - *id020 - immediate: - - *id013 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The properties - of an ImmutabilityPolicy of a blob - container., name: properties } - java: { description: The properties of - an ImmutabilityPolicy of a blob container., name: properties } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id025 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { description: The properties - of an ImmutabilityPolicy of a blob - container., name: ImmutabilityPolicyProperty, namespace: "" } - java: - { description: The properties of - an ImmutabilityPolicy of a blob - container., name: ImmutabilityPolicyProperty } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The immutability - period for the blobs in the container - since the policy creation, in - days.", - name: immutabilityPeriodSinceCreationInDays, - } - java: - { - description: - "The immutability - period for the blobs in the container - since the policy creation, in - days.", - name: immutabilityPeriodSinceCreationInDays, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id492 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { - description: - "The immutability - period for the blobs in the - container since the policy creation, - in days.", - name: ImmutabilityPolicyPropertyImmutabilityPeriodSinceCreationInDays, - } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: immutabilityPeriodSinceCreationInDays - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The ImmutabilityPolicy - state of a blob container, possible - values include: Locked and Unlocked.", - name: state, - } - java: - { - description: - "The ImmutabilityPolicy - state of a blob container, possible - values include: Locked and Unlocked.", - name: state, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id446 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: LOCKED, - } - value: Locked - - language: - default: - { - description: "", - name: UNLOCKED, - } - value: Unlocked - language: - default: - { - description: - "The ImmutabilityPolicy - state of a blob container, possible - values include: Locked and Unlocked.", - name: ImmutabilityPolicyState, - } - java: - { - description: - "The ImmutabilityPolicy - state of a blob container, possible - values include: Locked and Unlocked.", - name: ImmutabilityPolicyState, - } - protocol: {} - type: CHOICE - serializedName: state - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "This property - can only be changed for unlocked - time-based retention policies. - When enabled, new blocks can be - written to an append blob while - maintaining immutability protection - and compliance. Only new blocks - can be added and any existing - blocks cannot be modified or deleted. - This property cannot be changed - with ExtendImmutabilityPolicy - API", name: allowProtectedAppendWrites } - java: - { description: "This property - can only be changed for unlocked - time-based retention policies. - When enabled, new blocks can be - written to an append blob while - maintaining immutability protection - and compliance. Only new blocks - can be added and any existing - blocks cannot be modified or deleted. - This property cannot be changed - with ExtendImmutabilityPolicy - API", name: allowProtectedAppendWrites } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id418 - apiVersions: [] - language: - default: - { - description: - "This property - can only be changed for unlocked - time-based retention policies. - When enabled, new blocks can - be written to an append blob - while maintaining immutability - protection and compliance. Only - new blocks can be added and - any existing blocks cannot be - modified or deleted. This property - cannot be changed with ExtendImmutabilityPolicy - API", - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: allowProtectedAppendWrites - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - immediate: [] - extensions: - { - xmsAzureResource: true, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: false - language: - default: { description: Common fields that are - returned in the response for all Azure Resource - Manager resources, name: Resource, namespace: "", summary: Resource } - java: - { description: Common fields that are returned - in the response for all Azure Resource Manager - resources, name: Resource } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Fully qualified resource - ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", name: Id } - java: - { description: "Fully qualified resource - ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", name: id } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id657 - apiVersions: - - { version: "1.0" } - language: - default: { description: "Fully qualified - resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}", name: ResourceId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: id - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The name of the resource, - name: name, - } - java: - { - description: The name of the resource, - name: name, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id658 - apiVersions: - - { version: "1.0" } - language: - default: - { - description: The name of the resource, - name: ResourceName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The type of the resource. - E.g. "Microsoft.Compute/virtualMachines" - or "Microsoft.Storage/storageAccounts", name: type } - java: - { description: The type of the resource. - E.g. "Microsoft.Compute/virtualMachines" - or "Microsoft.Storage/storageAccounts", name: type } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id659 - apiVersions: - - { version: "1.0" } - language: - default: - { description: The type of the resource. - E.g. "Microsoft.Compute/virtualMachines" - or "Microsoft.Storage/storageAccounts", name: ResourceType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - protocol: {} - stronglyTypedHeader: false - summary: Resource - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id020 - immediate: - - *id013 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Properties of the blob - container., name: containerProperties } - java: - { - description: Properties of the blob container., - name: containerProperties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id028 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { - description: The properties of a container., - name: ContainerProperties, - namespace: "", - } - java: - { - description: The properties of a container., - name: ContainerProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The version of the - deleted blob container., name: version } - java: - { description: The version of the deleted - blob container., name: version } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id726 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: The version of the - deleted blob container., name: ContainerPropertiesVersion } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: version - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Indicates whether the - blob container was deleted., name: deleted } - java: { description: Indicates whether the - blob container was deleted., name: deleted } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id416 - apiVersions: [] - language: - default: { description: Indicates whether - the blob container was deleted., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: deleted - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Blob container deletion - time., name: deletedTime } - java: { description: Blob container deletion - time., name: deletedTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id473 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { description: Blob container deletion - time., name: ContainerPropertiesDeletedTime } - protocol: {} - type: DATE_TIME - serializedName: deletedTime - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Remaining retention - days for soft deleted blob container., name: remainingRetentionDays } - java: - { description: Remaining retention days - for soft deleted blob container., name: remainingRetentionDays } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id491 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: Remaining retention - days for soft deleted blob container., name: ContainerPropertiesRemainingRetentionDays } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: remainingRetentionDays - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Default the container - to use specified encryption scope for - all writes., name: defaultEncryptionScope } - java: { description: Default the container - to use specified encryption scope for - all writes., name: defaultEncryptionScope } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id727 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Default the container - to use specified encryption scope for - all writes., name: ContainerPropertiesDefaultEncryptionScope } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: defaultEncryptionScope - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - Block override of encryption - scope from the container default., - name: denyEncryptionScopeOverride, - } - java: - { - description: - Block override of encryption - scope from the container default., - name: denyEncryptionScopeOverride, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id417 - apiVersions: [] - language: - default: { description: Block override of - encryption scope from the container - default., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: denyEncryptionScopeOverride - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Specifies whether data - in the container may be accessed publicly - and the level of access., name: publicAccess } - java: { description: Specifies whether data - in the container may be accessed publicly - and the level of access., name: publicAccess } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id588 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { description: "", name: CONTAINER } - value: Container - - language: - default: - { description: "", name: BLOB } - value: Blob - - language: - default: - { description: "", name: NONE } - value: None - language: - default: { description: Specifies whether - data in the container may be accessed - publicly and the level of access., name: PublicAccess } - java: - { description: Specifies whether data - in the container may be accessed publicly - and the level of access., name: PublicAccess } - protocol: {} - type: SEALED_CHOICE - serializedName: publicAccess - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Returns the date and - time the container was last modified., name: lastModifiedTime } - java: - { description: Returns the date and time - the container was last modified., name: lastModifiedTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id474 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Returns the date - and time the container was last modified., name: ContainerPropertiesLastModifiedTime } - protocol: {} - type: DATE_TIME - serializedName: lastModifiedTime - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The lease status of - the container., name: leaseStatus } - java: { description: The lease status of the - container., name: leaseStatus } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id443 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { description: "", name: LOCKED } - value: Locked - - language: - default: - { description: "", name: UNLOCKED } - value: Unlocked - language: - default: { description: The lease status - of the container., name: LeaseStatus } - java: { description: The lease status of - the container., name: LeaseStatus } - protocol: {} - type: CHOICE - serializedName: leaseStatus - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Lease state of the - container., name: leaseState } - java: - { - description: Lease state of the container., - name: leaseState, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id444 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { description: "", name: AVAILABLE } - value: Available - - language: - default: - { description: "", name: LEASED } - value: Leased - - language: - default: - { description: "", name: EXPIRED } - value: Expired - - language: - default: - { description: "", name: BREAKING } - value: Breaking - - language: - default: - { description: "", name: BROKEN } - value: Broken - language: - default: { description: Lease state of the - container., name: LeaseState } - java: - { - description: Lease state of the container., - name: LeaseState, - } - protocol: {} - type: CHOICE - serializedName: leaseState - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Specifies whether - the lease on a container is of infinite - or fixed duration, only when the container - is leased.", name: leaseDuration } - java: { description: "Specifies whether the - lease on a container is of infinite or - fixed duration, only when the container - is leased.", name: leaseDuration } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id445 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { description: "", name: INFINITE } - value: Infinite - - language: - default: - { description: "", name: FIXED } - value: Fixed - language: - default: { description: "Specifies whether - the lease on a container is of infinite - or fixed duration, only when the container - is leased.", name: LeaseDuration } - java: - { description: "Specifies whether the - lease on a container is of infinite - or fixed duration, only when the container - is leased.", name: LeaseDuration } - protocol: {} - type: CHOICE - serializedName: leaseDuration - - apiVersions: [] - isDiscriminator: false - language: - default: { description: A name-value pair to - associate with the container as metadata., name: metadata } - java: - { - description: - A name-value pair to associate - with the container as metadata., - name: metadata, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id480 - apiVersions: [] - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id032 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: A name-value pair - to associate with the container as metadata., name: ContainerPropertiesMetadata } - java: { description: A name-value pair to - associate with the container as metadata., name: ContainerPropertiesMetadata } - protocol: {} - type: DICTIONARY - serializedName: metadata - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The ImmutabilityPolicy - property of the container., name: immutabilityPolicy } - java: { description: The ImmutabilityPolicy - property of the container., name: immutabilityPolicy } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id576 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The properties of - an ImmutabilityPolicy of a blob container., name: ImmutabilityPolicyProperties, namespace: "" } - java: { description: The properties of an - ImmutabilityPolicy of a blob container., name: ImmutabilityPolicyProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The properties - of an ImmutabilityPolicy of a blob - container., name: properties } - java: { description: The properties of - an ImmutabilityPolicy of a blob container., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id025 - serializedName: properties - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: ImmutabilityPolicy - Etag., name: etag } - java: - { description: ImmutabilityPolicy - Etag., name: etag } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id728 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: ImmutabilityPolicy - Etag., name: ImmutabilityPolicyPropertiesEtag } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: etag - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - The ImmutabilityPolicy - update history of the blob container., - name: updateHistory, - } - java: - { - description: - The ImmutabilityPolicy - update history of the blob container., - name: updateHistory, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id389 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id577 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: An update history - of the ImmutabilityPolicy of a - blob container., name: UpdateHistoryProperty, namespace: "" } - java: - { description: An update history - of the ImmutabilityPolicy of a - blob container., name: UpdateHistoryProperty } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The ImmutabilityPolicy - update type of a blob container, - possible values include: put, - lock and extend.", - name: update, - } - java: - { - description: - "The ImmutabilityPolicy - update type of a blob container, - possible values include: put, - lock and extend.", - name: update, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id447 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { - description: "", - name: PUT, - } - value: put - - language: - default: - { - description: "", - name: LOCK, - } - value: lock - - language: - default: - { - description: "", - name: EXTEND, - } - value: extend - language: - default: - { - description: - "The ImmutabilityPolicy - update type of a blob container, - possible values include: put, - lock and extend.", - name: ImmutabilityPolicyUpdateType, - } - java: - { - description: - "The ImmutabilityPolicy - update type of a blob container, - possible values include: put, - lock and extend.", - name: ImmutabilityPolicyUpdateType, - } - protocol: {} - type: CHOICE - serializedName: update - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The immutability - period for the blobs in the - container since the policy creation, - in days.", - name: immutabilityPeriodSinceCreationInDays, - } - java: - { - description: - "The immutability - period for the blobs in the - container since the policy creation, - in days.", - name: immutabilityPeriodSinceCreationInDays, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id493 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { - description: - "The immutability - period for the blobs in the - container since the policy - creation, in days.", - name: UpdateHistoryPropertyImmutabilityPeriodSinceCreationInDays, - } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: immutabilityPeriodSinceCreationInDays - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - date and time the ImmutabilityPolicy - was updated., name: timestamp } - java: - { description: Returns the - date and time the ImmutabilityPolicy - was updated., name: timestamp } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id475 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { description: Returns - the date and time the ImmutabilityPolicy - was updated., name: UpdateHistoryPropertyTimestamp } - protocol: {} - type: DATE_TIME - serializedName: timestamp - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - Object ID of the user who updated - the ImmutabilityPolicy., name: objectIdentifier } - java: - { description: Returns the - Object ID of the user who updated - the ImmutabilityPolicy., name: objectIdentifier } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id729 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Returns - the Object ID of the user - who updated the ImmutabilityPolicy., name: UpdateHistoryPropertyObjectIdentifier } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: objectIdentifier - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - Tenant ID that issued the token - for the user who updated the - ImmutabilityPolicy., name: tenantId } - java: - { description: Returns the - Tenant ID that issued the token - for the user who updated the - ImmutabilityPolicy., name: tenantId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id730 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Returns - the Tenant ID that issued - the token for the user who - updated the ImmutabilityPolicy., name: UpdateHistoryPropertyTenantId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: tenantId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - User Principal Name of the user - who updated the ImmutabilityPolicy., name: upn } - java: - { description: Returns the - User Principal Name of the user - who updated the ImmutabilityPolicy., name: upn } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id731 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Returns - the User Principal Name of - the user who updated the ImmutabilityPolicy., name: UpdateHistoryPropertyUpn } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: upn - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { - description: - The ImmutabilityPolicy - update history of the blob container., - name: ImmutabilityPolicyPropertiesUpdateHistory, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: updateHistory - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: immutabilityPolicy - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The LegalHold property - of the container., name: legalHold } - java: { description: The LegalHold property - of the container., name: legalHold } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id578 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: The LegalHold property - of a blob container., name: LegalHoldProperties, namespace: "" } - java: - { description: The LegalHold property - of a blob container., name: LegalHoldProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The hasLegalHold - public property is set to true by - SRP if there are at least one existing - tag. The hasLegalHold public property - is set to false by SRP if all existing - legal hold tags are cleared out. There - can be a maximum of 1000 blob containers - with hasLegalHold=true for a given - account., name: hasLegalHold } - java: - { - description: - The hasLegalHold public - property is set to true by SRP if - there are at least one existing tag. - The hasLegalHold public property is - set to false by SRP if all existing - legal hold tags are cleared out. There - can be a maximum of 1000 blob containers - with hasLegalHold=true for a given - account., - name: hasLegalHold, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id026 - apiVersions: [] - language: - default: - { description: The hasLegalHold - public property is set to true by - SRP if there are at least one existing - tag. The hasLegalHold public property - is set to false by SRP if all existing - legal hold tags are cleared out. - There can be a maximum of 1000 blob - containers with hasLegalHold=true - for a given account., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: hasLegalHold - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The list of LegalHold - tags of a blob container., name: tags } - java: - { description: The list of LegalHold - tags of a blob container., name: tags } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id390 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id579 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: A tag of the - LegalHold of a blob container., name: TagProperty, namespace: "" } - java: - { - description: - A tag of the LegalHold - of a blob container., - name: TagProperty, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The tag value., - name: tag, - } - java: - { - description: The tag value., - name: tag, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id732 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: The tag - value., name: TagPropertyTag } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: tag - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - date and time the tag was added., name: timestamp } - java: - { description: Returns the - date and time the tag was added., name: timestamp } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id476 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { description: Returns - the date and time the tag - was added., name: TagPropertyTimestamp } - protocol: {} - type: DATE_TIME - serializedName: timestamp - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - Object ID of the user who added - the tag., name: objectIdentifier } - java: - { description: Returns the - Object ID of the user who added - the tag., name: objectIdentifier } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id733 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Returns - the Object ID of the user - who added the tag., name: TagPropertyObjectIdentifier } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: objectIdentifier - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - Tenant ID that issued the token - for the user who added the tag., name: tenantId } - java: - { description: Returns the - Tenant ID that issued the token - for the user who added the tag., name: tenantId } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id734 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Returns - the Tenant ID that issued - the token for the user who - added the tag., name: TagPropertyTenantId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: tenantId - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Returns the - User Principal Name of the user - who added the tag., name: upn } - java: - { description: Returns the - User Principal Name of the user - who added the tag., name: upn } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id735 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Returns - the User Principal Name of - the user who added the tag., name: TagPropertyUpn } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: upn - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { - description: - The list of LegalHold - tags of a blob container., - name: LegalHoldPropertiesTags, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: tags - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: legalHold - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The hasLegalHold public - property is set to true by SRP if there - are at least one existing tag. The hasLegalHold - public property is set to false by SRP - if all existing legal hold tags are cleared - out. There can be a maximum of 1000 blob - containers with hasLegalHold=true for - a given account., name: hasLegalHold } - java: { description: The hasLegalHold public - property is set to true by SRP if there - are at least one existing tag. The hasLegalHold - public property is set to false by SRP - if all existing legal hold tags are cleared - out. There can be a maximum of 1000 blob - containers with hasLegalHold=true for - a given account., name: hasLegalHold } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id026 - serializedName: hasLegalHold - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The hasImmutabilityPolicy - public property is set to true by SRP - if ImmutabilityPolicy has been created - for this container. The hasImmutabilityPolicy - public property is set to false by SRP - if ImmutabilityPolicy has not been created - for this container., name: hasImmutabilityPolicy } - java: - { description: The hasImmutabilityPolicy - public property is set to true by SRP - if ImmutabilityPolicy has been created - for this container. The hasImmutabilityPolicy - public property is set to false by SRP - if ImmutabilityPolicy has not been created - for this container., name: hasImmutabilityPolicy } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id419 - apiVersions: [] - language: - default: - { description: The hasImmutabilityPolicy - public property is set to true by SRP - if ImmutabilityPolicy has been created - for this container. The hasImmutabilityPolicy - public property is set to false by SRP - if ImmutabilityPolicy has not been created - for this container., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: hasImmutabilityPolicy - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - *id027 - immediate: - - *id012 - - *id024 - - *id027 - flattenedSchema: false - language: - default: { description: The resource model definition - for an Azure Resource Manager resource with an etag., name: AzureEntityResource, namespace: "", summary: Entity - Resource } - java: { description: The resource model definition for - an Azure Resource Manager resource with an etag., name: AzureEntityResource } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - immediate: - - *id020 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Resource Etag., name: etag } - java: { description: Resource Etag., name: etag } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id736 - apiVersions: - - { version: "1.0" } - language: - default: - { - description: Resource Etag., - name: AzureEntityResourceEtag, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: etag - protocol: {} - stronglyTypedHeader: false - summary: Entity Resource - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - *id014 - - *id020 - immediate: - - *id013 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The blob container properties be - listed out., name: properties } - java: { description: The blob container properties be listed - out., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id028 - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { - description: List of blobs containers returned., - name: ListContainerItemsValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Request URL that can be used to query - next page of containers. Returned when total number of requested - containers exceed maximum page size., name: nextLink } - java: { description: Request URL that can be used to query next - page of containers. Returned when total number of requested - containers exceed maximum page size., name: nextLink } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id737 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Request URL that can be used to query - next page of containers. Returned when total number of - requested containers exceed maximum page size., name: ListContainerItemsNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id029 - operationGroup: *id005 - operationId: BlobContainers_List - parameters: - - *id030 - - &id033 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id009 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id042 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 90.0 - minLength: 1.0 - pattern: ^[-\w\._\(\)]+$ - protocol: {} - type: STRING - - &id034 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id009 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id043 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 24.0 - minLength: 3.0 - protocol: {} - type: STRING - - &id035 - apiVersions: [] - flattened: false - implementation: CLIENT - language: - default: - { description: Api Version, name: apiVersion, serializedName: api-version } - java: { description: Api Version, name: apiVersion, serializedName: api-version } - nullable: false - operation: *id008 - origin: modelerfour:synthesized/api-version - protocol: - http: { explode: false, in: QUERY } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id449 - apiVersions: [] - language: - default: { description: Api Version (2021-01-01), name: ApiVersion202101 } - protocol: {} - type: CONSTANT - value: { value: "2021-01-01" } - valueType: *id010 - - *id031 - - &id036 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Optional. Specified maximum number of containers - that can be included in the list., name: maxpagesize, serializedName: $maxpagesize } - java: { description: Optional. Specified maximum number of containers that - can be included in the list., name: maxpagesize, serializedName: $maxpagesize } - nullable: false - operation: *id009 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id032 - - &id037 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Optional. When specified, only container names - starting with the filter will be listed.", name: filter, serializedName: $filter } - java: { description: "Optional. When specified, only container names starting - with the filter will be listed.", name: filter, serializedName: $filter } - nullable: false - operation: *id009 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: *id032 - - &id038 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Optional, used to include the properties for soft - deleted blob containers.", name: include, serializedName: $include } - java: { description: "Optional, used to include the properties for soft - deleted blob containers.", name: include, serializedName: $include } - nullable: false - operation: *id009 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id442 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: DELETED } - value: deleted - language: - default: { description: "", name: ListContainersInclude } - java: { description: "", name: ListContainersInclude } - protocol: {} - type: CHOICE - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id033 - - *id034 - - *id035 - - *id031 - - *id036 - - *id037 - - *id038 - - *id039 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers", - uri: "{$host}", - } - signatureParameters: - - *id033 - - *id034 - - *id036 - - *id037 - - *id038 - responses: *id040 - signatureParameters: - - *id033 - - *id034 - - *id036 - - *id037 - - *id038 - - &id041 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - PutContainerWithDefaultEncryptionScope: - parameters: - accountName: sto328 - api-version: 2020-08-01-preview - blobContainer: - properties: - { - defaultEncryptionScope: encryptionscope185, - denyEncryptionScopeOverride: true, - } - containerName: container6185 - monitor: "true" - resourceGroupName: res3376 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersPutDefaultEncryptionScope.json - responses: - "200": - body: - name: container6185 - type: Microsoft.Storage/storageAccounts/blobServices/containers - id: /subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185 - properties: - { - defaultEncryptionScope: encryptionscope185, - denyEncryptionScopeOverride: true, - } - "201": - body: - name: container6185 - type: Microsoft.Storage/storageAccounts/blobServices/containers - id: /subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185 - properties: - { - defaultEncryptionScope: encryptionscope185, - denyEncryptionScopeOverride: true, - } - PutContainers: - parameters: - accountName: sto328 - api-version: 2020-08-01-preview - blobContainer: {} - containerName: container6185 - monitor: "true" - resourceGroupName: res3376 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersPut.json - responses: - "200": - body: - { - name: container6185, - type: Microsoft.Storage/storageAccounts/blobServices/containers, - id: "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185", - } - "201": - body: - { - name: container6185, - type: Microsoft.Storage/storageAccounts/blobServices/containers, - id: "/subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185", - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Creates a new container under the specified account - as described by request body. The container resource includes metadata - and properties for that container. It does not include a list of the - blobs contained by the container. ", name: Create } - java: { description: "Creates a new container under the specified account - as described by request body. The container resource includes metadata - and properties for that container. It does not include a list of the - blobs contained by the container. ", name: create } - operationGroup: *id005 - operationId: BlobContainers_Create - parameters: - - *id030 - - &id044 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id041 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id045 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id041 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id046 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id041 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id050 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 63.0 - minLength: 3.0 - protocol: {} - type: STRING - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id044 - - *id045 - - *id046 - - *id035 - - *id031 - - &id048 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Properties of the blob container to create., - name: blobContainer, - } - java: - { - description: Properties of the blob container to create., - name: blobContainer, - } - nullable: false - operation: *id041 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id024 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id041 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName} - uri: "{$host}" - signatureParameters: - - *id044 - - *id045 - - *id046 - - *id048 - responses: - - language: - default: { description: OK -- The Container is already created., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id024 - - language: - default: { description: Created -- Create Container operation completed - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id024 - signatureParameters: - - *id044 - - *id045 - - *id046 - - &id049 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - UpdateContainers: - parameters: - accountName: sto328 - api-version: 2020-08-01-preview - blobContainer: - properties: - metadata: { metadata: "true" } - publicAccess: Container - containerName: container6185 - monitor: "true" - resourceGroupName: res3376 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersPatch.json - responses: - "200": - body: - name: container6185 - type: Microsoft.Storage/storageAccounts/blobServices/containers - id: /subscriptions/{subscription-id}/resourceGroups/res3376/providers/Microsoft.Storage/storageAccounts/sto328/blobServices/default/containers/container6185 - properties: - hasImmutabilityPolicy: false - hasLegalHold: false - metadata: { metadata: "true" } - publicAccess: Container - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Updates container properties as specified in request - body. Properties not mentioned in the request will be unchanged. Update - fails if the specified container doesn't already exist. ", name: Update } - java: { description: "Updates container properties as specified in request - body. Properties not mentioned in the request will be unchanged. Update - fails if the specified container doesn't already exist. ", name: update } - operationGroup: *id005 - operationId: BlobContainers_Update - parameters: - - *id030 - - &id051 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id049 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id052 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id049 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id053 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id049 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id051 - - *id052 - - *id053 - - *id035 - - *id031 - - &id054 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Properties to update for the blob container., - name: blobContainer, - } - java: - { - description: Properties to update for the blob container., - name: blobContainer, - } - nullable: false - operation: *id049 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id024 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id049 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: patch - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName} - uri: "{$host}" - signatureParameters: - - *id051 - - *id052 - - *id053 - - *id054 - responses: - - language: - default: - { - description: OK -- Update Container operation completed successfully., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id024 - signatureParameters: - - *id051 - - *id052 - - *id053 - - &id055 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - GetContainers: - parameters: - { - accountName: sto6217, - api-version: 2020-08-01-preview, - containerName: container1634, - monitor: "true", - resourceGroupName: res9871, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersGet.json - responses: - "200": - body: - name: container1634 - type: Microsoft.Storage/storageAccounts/blobServices/containers - etag: '"0x8D592D74CC20EBA"' - id: /subscriptions/{subscription-id}/resourceGroups/res9871/providers/Microsoft.Storage/storageAccounts/sto6217/blobServices/default/containers/container1634 - properties: - hasImmutabilityPolicy: true - hasLegalHold: true - immutabilityPolicy: - etag: '"8d592d74cb3011a"' - properties: - { immutabilityPeriodSinceCreationInDays: 100, state: Locked } - updateHistory: - - { - immutabilityPeriodSinceCreationInDays: 3, - objectIdentifier: ce7cd28a-fc25-4bf1-8fb9-e1b9833ffd4b, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - timestamp: "2018-03-26T05:06:11.431403Z", - update: put, - } - - { - immutabilityPeriodSinceCreationInDays: 3, - objectIdentifier: ce7cd28a-fc25-4bf1-8fb9-e1b9833ffd4b, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - timestamp: "2018-03-26T05:06:13.0907641Z", - update: lock, - } - - { - immutabilityPeriodSinceCreationInDays: 100, - objectIdentifier: ce7cd28a-fc25-4bf1-8fb9-e1b9833ffd4b, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - timestamp: "2018-03-26T05:06:14.7097716Z", - update: extend, - } - lastModifiedTime: "2018-03-26T05:06:14Z" - leaseState: Available - leaseStatus: Unlocked - legalHold: - hasLegalHold: true - tags: - - { - objectIdentifier: ce7cd28a-fc25-4bf1-8fb9-e1b9833ffd4b, - tag: tag1, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - timestamp: "2018-03-26T05:06:09.6964643Z", - } - - { - objectIdentifier: ce7cd28a-fc25-4bf1-8fb9-e1b9833ffd4b, - tag: tag2, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - timestamp: "2018-03-26T05:06:09.6964643Z", - } - - { - objectIdentifier: ce7cd28a-fc25-4bf1-8fb9-e1b9833ffd4b, - tag: tag3, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - timestamp: "2018-03-26T05:06:09.6964643Z", - } - publicAccess: None - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Gets properties of a specified container. ", name: Get } - java: { description: "Gets properties of a specified container. ", name: get } - operationGroup: *id005 - operationId: BlobContainers_Get - parameters: - - *id030 - - &id056 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id057 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id058 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id055 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id056 - - *id057 - - *id058 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id055 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}", - uri: "{$host}", - } - signatureParameters: - - *id056 - - *id057 - - *id058 - responses: - - language: - default: - { description: OK -- Get Container operation completed successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id024 - signatureParameters: - - *id056 - - *id057 - - *id058 - - &id059 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - DeleteContainers: - parameters: - { - accountName: sto4506, - api-version: 2020-08-01-preview, - containerName: container9689, - monitor: "true", - resourceGroupName: res4079, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersDelete.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes specified container under its account., name: Delete } - java: { description: Deletes specified container under its account., name: delete } - operationGroup: *id005 - operationId: BlobContainers_Delete - parameters: - - *id030 - - &id060 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id059 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id061 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id059 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id062 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id059 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id060 - - *id061 - - *id062 - - *id035 - - *id031 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}", - uri: "{$host}", - } - signatureParameters: - - *id060 - - *id061 - - *id062 - responses: - - language: - default: - { - description: OK -- Delete Container operation completed successfully., - name: "", - } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content -- The Container not exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id060 - - *id061 - - *id062 - - &id063 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SetLegalHoldContainers: - parameters: - LegalHold: - tags: [tag1, tag2, tag3] - accountName: sto7280 - api-version: 2020-08-01-preview - containerName: container8723 - monitor: "true" - resourceGroupName: res4303 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersSetLegalHold.json - responses: - "200": - body: - hasLegalHold: true - tags: [tag1, tag2, tag3] - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Sets legal hold tags. Setting the same tag results - in an idempotent operation. SetLegalHold follows an append pattern and - does not clear out the existing tags that are not specified in the request., name: SetLegalHold } - java: { description: Sets legal hold tags. Setting the same tag results in - an idempotent operation. SetLegalHold follows an append pattern and - does not clear out the existing tags that are not specified in the request., name: setLegalHold } - operationGroup: *id005 - operationId: BlobContainers_SetLegalHold - parameters: - - *id030 - - &id064 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id063 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id065 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id063 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id066 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id063 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id064 - - *id065 - - *id066 - - *id035 - - *id031 - - &id067 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The LegalHold property that will be set to a - blob container., name: legalHold } - java: { description: The LegalHold property that will be set to a blob - container., name: legalHold } - nullable: false - operation: *id063 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id068 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The LegalHold property of a blob container., - name: LegalHold, - namespace: "", - } - java: - { - description: The LegalHold property of a blob container., - name: LegalHold, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The hasLegalHold public property is set to - true by SRP if there are at least one existing tag. The hasLegalHold - public property is set to false by SRP if all existing legal - hold tags are cleared out. There can be a maximum of 1000 blob - containers with hasLegalHold=true for a given account., name: hasLegalHold } - java: { description: The hasLegalHold public property is set to true - by SRP if there are at least one existing tag. The hasLegalHold - public property is set to false by SRP if all existing legal - hold tags are cleared out. There can be a maximum of 1000 blob - containers with hasLegalHold=true for a given account., name: hasLegalHold } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id026 - serializedName: hasLegalHold - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Each tag should be 3 to 23 alphanumeric characters - and is normalized to lower case at SRP., name: tags } - java: { description: Each tag should be 3 to 23 alphanumeric characters - and is normalized to lower case at SRP., name: tags } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id392 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id738 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: LegalHoldTagsItem } - maxLength: 23.0 - minLength: 3.0 - protocol: {} - type: STRING - language: - default: { description: Each tag should be 3 to 23 alphanumeric - characters and is normalized to lower case at SRP., name: LegalHoldTags } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: tags - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id063 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/setLegalHold - uri: "{$host}" - signatureParameters: - - *id064 - - *id065 - - *id066 - - *id067 - responses: - - language: - default: { description: OK -- Set legal hold tags for Container completed - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id068 - signatureParameters: - - *id064 - - *id065 - - *id066 - - &id069 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - ClearLegalHoldContainers: - parameters: - LegalHold: - tags: [tag1, tag2, tag3] - accountName: sto7280 - api-version: 2020-08-01-preview - containerName: container8723 - monitor: "true" - resourceGroupName: res4303 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersClearLegalHold.json - responses: - "200": - body: - hasLegalHold: false - tags: [] - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Clears legal hold tags. Clearing the same or non-existent - tag results in an idempotent operation. ClearLegalHold clears out only - the specified tags in the request., name: ClearLegalHold } - java: { description: Clears legal hold tags. Clearing the same or non-existent - tag results in an idempotent operation. ClearLegalHold clears out only - the specified tags in the request., name: clearLegalHold } - operationGroup: *id005 - operationId: BlobContainers_ClearLegalHold - parameters: - - *id030 - - &id070 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id069 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id071 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id069 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id072 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id069 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id070 - - *id071 - - *id072 - - *id035 - - *id031 - - &id073 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The LegalHold property that will be clear from - a blob container., name: legalHold } - java: { description: The LegalHold property that will be clear from a - blob container., name: legalHold } - nullable: false - operation: *id069 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id068 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id069 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/clearLegalHold - uri: "{$host}" - signatureParameters: - - *id070 - - *id071 - - *id072 - - *id073 - responses: - - language: - default: { description: OK -- Clear legal hold tags for Container completed - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id068 - signatureParameters: - - *id070 - - *id071 - - *id072 - - &id074 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - CreateOrUpdateImmutabilityPolicy: - parameters: - accountName: sto7069 - api-version: 2020-08-01-preview - containerName: container6397 - immutabilityPolicyName: default - monitor: "true" - parameters: - properties: - { - allowProtectedAppendWrites: true, - immutabilityPeriodSinceCreationInDays: 3, - } - resourceGroupName: res1782 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersPutImmutabilityPolicy.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies - etag: '"8d59f830cb130e5"' - id: /subscriptions/{subscription-id}/resourceGroups/res1782/providers/Microsoft.Storage/storageAccounts/sto7069/blobServices/default/containers/container6397/immutabilityPolicies/default - properties: - { - allowProtectedAppendWrites: true, - immutabilityPeriodSinceCreationInDays: 3, - state: Unlocked, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Creates or updates an unlocked immutability policy. - ETag in If-Match is honored if given but not required for this operation., name: CreateOrUpdateImmutabilityPolicy } - java: { description: Creates or updates an unlocked immutability policy. - ETag in If-Match is honored if given but not required for this operation., name: createOrUpdateImmutabilityPolicy } - operationGroup: *id005 - operationId: BlobContainers_CreateOrUpdateImmutabilityPolicy - parameters: - - *id030 - - &id075 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id074 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id076 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id074 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id077 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id074 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - &id078 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the blob container immutabilityPolicy - within the specified storage account. ImmutabilityPolicy Name must - be 'default', name: immutabilityPolicyName, serializedName: immutabilityPolicyName } - java: { description: The name of the blob container immutabilityPolicy - within the specified storage account. ImmutabilityPolicy Name must - be 'default', name: immutabilityPolicyName, serializedName: immutabilityPolicyName } - nullable: false - operation: *id074 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id082 - apiVersions: [] - language: - default: { description: "", name: Constant53 } - protocol: {} - type: CONSTANT - value: { value: default } - valueType: *id010 - - *id035 - - *id031 - - &id079 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - java: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - nullable: false - operation: *id074 - protocol: - http: { explode: false, in: HEADER } - required: false - schema: *id032 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id075 - - *id076 - - *id077 - - *id078 - - *id035 - - *id031 - - *id079 - - &id080 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The ImmutabilityPolicy Properties that will be - created or updated to a blob container., name: parameters } - java: { description: The ImmutabilityPolicy Properties that will be created - or updated to a blob container., name: parameters } - nullable: false - operation: *id074 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: false - schema: *id027 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id074 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName} - uri: "{$host}" - signatureParameters: - - *id075 - - *id076 - - *id077 - - *id079 - - *id080 - responses: - - language: - default: { description: OK -- Creates or updates container ImmutabilityPolicy - operation completed successfully., name: "" } - protocol: - http: - explode: false - headers: - - header: Etag - schema: *id032 - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id075 - - *id076 - - *id077 - - *id079 - - &id081 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - GetImmutabilityPolicy: - parameters: - { - accountName: sto9177, - api-version: 2020-08-01-preview, - containerName: container3489, - immutabilityPolicyName: default, - monitor: "true", - resourceGroupName: res5221, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersGetImmutabilityPolicy.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies - etag: '"8d59f828e64b75c"' - id: /subscriptions/{subscription-id}/resourceGroups/res5221/providers/Microsoft.Storage/storageAccounts/sto9177/blobServices/default/containers/container3489/immutabilityPolicies/default - properties: - { - allowProtectedAppendWrites: true, - immutabilityPeriodSinceCreationInDays: 5, - state: Unlocked, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets the existing immutability policy along with - the corresponding ETag in response headers and body., name: GetImmutabilityPolicy } - java: { description: Gets the existing immutability policy along with the - corresponding ETag in response headers and body., name: getImmutabilityPolicy } - operationGroup: *id005 - operationId: BlobContainers_GetImmutabilityPolicy - parameters: - - *id030 - - &id083 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id081 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id084 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id081 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id085 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id081 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - &id086 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the blob container immutabilityPolicy - within the specified storage account. ImmutabilityPolicy Name must - be 'default', name: immutabilityPolicyName, serializedName: immutabilityPolicyName } - java: { description: The name of the blob container immutabilityPolicy - within the specified storage account. ImmutabilityPolicy Name must - be 'default', name: immutabilityPolicyName, serializedName: immutabilityPolicyName } - nullable: false - operation: *id081 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id082 - - *id035 - - *id031 - - &id087 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - java: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - nullable: false - operation: *id081 - protocol: - http: { explode: false, in: HEADER } - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id088 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id083 - - *id084 - - *id085 - - *id086 - - *id035 - - *id031 - - *id087 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id081 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}", - uri: "{$host}", - } - signatureParameters: - - *id083 - - *id084 - - *id085 - - *id087 - responses: - - language: - default: { description: OK -- Gets container ImmutabilityPolicy operation - completed successfully., name: "" } - protocol: - http: - explode: false - headers: - - header: Etag - schema: *id088 - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id083 - - *id084 - - *id085 - - *id087 - - &id089 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - DeleteImmutabilityPolicy: - parameters: - { - If-Match: '"8d59f81a7fa7be0"', - accountName: sto9621, - api-version: 2020-08-01-preview, - containerName: container4910, - immutabilityPolicyName: default, - monitor: "true", - resourceGroupName: res1581, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersDeleteImmutabilityPolicy.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies - etag: '"8d59f81a87b40c0"' - id: /subscriptions/{subscription-id}/resourceGroups/res1581/providers/Microsoft.Storage/storageAccounts/sto9621/blobServices/default/containers/container4910/immutabilityPolicies/default - properties: { immutabilityPeriodSinceCreationInDays: 0, state: Unlocked } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Aborts an unlocked immutability policy. The response - of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in - If-Match is required for this operation. Deleting a locked immutability - policy is not allowed, the only way is to delete the container after - deleting all expired blobs inside the policy locked container.", name: DeleteImmutabilityPolicy } - java: { description: "Aborts an unlocked immutability policy. The response - of delete has immutabilityPeriodSinceCreationInDays set to 0. ETag in - If-Match is required for this operation. Deleting a locked immutability - policy is not allowed, the only way is to delete the container after - deleting all expired blobs inside the policy locked container.", name: deleteImmutabilityPolicy } - operationGroup: *id005 - operationId: BlobContainers_DeleteImmutabilityPolicy - parameters: - - *id030 - - &id090 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id089 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id091 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id089 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id092 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id089 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - &id093 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the blob container immutabilityPolicy - within the specified storage account. ImmutabilityPolicy Name must - be 'default', name: immutabilityPolicyName, serializedName: immutabilityPolicyName } - java: { description: The name of the blob container immutabilityPolicy - within the specified storage account. ImmutabilityPolicy Name must - be 'default', name: immutabilityPolicyName, serializedName: immutabilityPolicyName } - nullable: false - operation: *id089 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id082 - - *id035 - - *id031 - - &id094 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - java: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - nullable: false - operation: *id089 - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id095 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id090 - - *id091 - - *id092 - - *id093 - - *id035 - - *id031 - - *id094 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id089 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/{immutabilityPolicyName}", - uri: "{$host}", - } - signatureParameters: - - *id090 - - *id091 - - *id092 - - *id094 - responses: - - language: - default: { description: OK -- Deletes container ImmutabilityPolicy operation - completed successfully., name: "" } - protocol: - http: - explode: false - headers: - - header: Etag - schema: *id095 - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id090 - - *id091 - - *id092 - - *id094 - - &id096 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - LockImmutabilityPolicy: - parameters: - { - If-Match: '"8d59f825b721dd3"', - accountName: sto5009, - api-version: 2020-08-01-preview, - containerName: container1631, - monitor: "true", - resourceGroupName: res2702, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersLockImmutabilityPolicy.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies - etag: '"8d57a8a5edb084a"' - id: /subscriptions/{subscription-id}/resourceGroups/res2702/providers/Microsoft.Storage/storageAccounts/sto5009/blobServices/default/containers/container1631/immutabilityPolicies/default - properties: { immutabilityPeriodSinceCreationInDays: 3, state: Locked } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Sets the ImmutabilityPolicy to Locked state. The - only action allowed on a Locked policy is ExtendImmutabilityPolicy action. - ETag in If-Match is required for this operation., name: LockImmutabilityPolicy } - java: { description: Sets the ImmutabilityPolicy to Locked state. The only - action allowed on a Locked policy is ExtendImmutabilityPolicy action. - ETag in If-Match is required for this operation., name: lockImmutabilityPolicy } - operationGroup: *id005 - operationId: BlobContainers_LockImmutabilityPolicy - parameters: - - *id030 - - &id097 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id096 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id098 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id096 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id099 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id096 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - - &id100 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - java: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - nullable: false - operation: *id096 - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id101 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id097 - - *id098 - - *id099 - - *id035 - - *id031 - - *id100 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id096 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/lock", - uri: "{$host}", - } - signatureParameters: - - *id097 - - *id098 - - *id099 - - *id100 - responses: - - language: - default: { description: OK -- Locks container ImmutabilityPolicy operation - completed successfully., name: "" } - protocol: - http: - explode: false - headers: - - header: Etag - schema: *id101 - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id097 - - *id098 - - *id099 - - *id100 - - &id102 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - ExtendImmutabilityPolicy: - parameters: - If-Match: '"8d59f830d0c3bf9"' - accountName: sto232 - api-version: 2020-08-01-preview - containerName: container5023 - monitor: "true" - parameters: - properties: { immutabilityPeriodSinceCreationInDays: 100 } - resourceGroupName: res6238 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobContainersExtendImmutabilityPolicy.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices/containers/immutabilityPolicies - etag: '"8d57a8b2ff50332"' - id: /subscriptions/{subscription-id}/resourceGroups/res6238/providers/Microsoft.Storage/storageAccounts/sto232/blobServices/default/containers/container5023/immutabilityPolicies/default - properties: { immutabilityPeriodSinceCreationInDays: 100, state: Locked } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Extends the immutabilityPeriodSinceCreationInDays - of a locked immutabilityPolicy. The only action allowed on a Locked - policy will be this action. ETag in If-Match is required for this operation., name: ExtendImmutabilityPolicy } - java: { description: Extends the immutabilityPeriodSinceCreationInDays of - a locked immutabilityPolicy. The only action allowed on a Locked policy - will be this action. ETag in If-Match is required for this operation., name: extendImmutabilityPolicy } - operationGroup: *id005 - operationId: BlobContainers_ExtendImmutabilityPolicy - parameters: - - *id030 - - &id103 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's - subscription. The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: - { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id102 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id104 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id102 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id105 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a - letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id102 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - - &id106 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - java: { description: 'The entity state (ETag) version of the immutability - policy to update. A value of "*" can be used to apply the operation - only if the immutability policy already exists. If omitted, this operation - will always be applied.', name: ifMatch, serializedName: If-Match } - nullable: false - operation: *id102 - protocol: - http: { explode: false, in: HEADER } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id108 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id103 - - *id104 - - *id105 - - *id035 - - *id031 - - *id106 - - &id107 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The ImmutabilityPolicy Properties that will be - extended for a blob container., name: parameters } - java: { description: The ImmutabilityPolicy Properties that will be extended - for a blob container., name: parameters } - nullable: false - operation: *id102 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: false - schema: *id027 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id102 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/immutabilityPolicies/default/extend - uri: "{$host}" - signatureParameters: - - *id103 - - *id104 - - *id105 - - *id106 - - *id107 - responses: - - language: - default: { description: OK -- Extends container ImmutabilityPolicy operation - completed successfully.., name: "" } - protocol: - http: - explode: false - headers: - - header: Etag - schema: *id108 - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id027 - signatureParameters: - - *id103 - - *id104 - - *id105 - - *id106 - - *id008 - - *id007 - protocol: {} - operationId: BlobContainers_Lease - parameters: - - *id030 - - &id109 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id008 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id110 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id008 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id111 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the blob container within the specified - storage account. Blob container names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a letter - or number.", name: containerName, serializedName: containerName } - java: { description: "The name of the blob container within the specified storage - account. Blob container names must be between 3 and 63 characters in length - and use numbers, lower-case letters and dash (-) only. Every dash (-) - character must be immediately preceded and followed by a letter or number.", name: containerName, serializedName: containerName } - nullable: false - operation: *id008 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id109 - - *id110 - - *id111 - - *id035 - - *id031 - - &id112 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Lease Container request body., name: parameters } - java: { description: Lease Container request body., name: parameters } - nullable: false - operation: *id008 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id580 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Lease Container request schema., - name: LeaseContainerRequest, - namespace: "", - } - java: - { description: Lease Container request schema., name: LeaseContainerRequest } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Specifies the lease action. Can be one of the - available actions., name: action } - java: { description: Specifies the lease action. Can be one of the available - actions., name: action } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id448 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: ACQUIRE } - value: Acquire - - language: - default: { description: "", name: RENEW } - value: Renew - - language: - default: { description: "", name: CHANGE } - value: Change - - language: - default: { description: "", name: RELEASE } - value: Release - - language: - default: { description: "", name: BREAK } - value: Break - language: - default: { description: Specifies the lease action. Can be one of the - available actions., name: LeaseContainerRequestAction } - java: { description: Specifies the lease action. Can be one of the - available actions., name: LeaseContainerRequestAction } - protocol: {} - type: CHOICE - serializedName: action - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Identifies the lease. Can be specified in any - valid GUID string format., name: leaseId } - java: { description: Identifies the lease. Can be specified in any valid - GUID string format., name: leaseId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id739 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Identifies the lease. Can be specified in any - valid GUID string format., name: LeaseContainerRequestLeaseId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: leaseId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Optional. For a break action, proposed duration - the lease should continue before it is broken, in seconds, between - 0 and 60.", name: breakPeriod } - java: { description: "Optional. For a break action, proposed duration - the lease should continue before it is broken, in seconds, between - 0 and 60.", name: breakPeriod } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id494 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: "Optional. For a break action, proposed duration - the lease should continue before it is broken, in seconds, between - 0 and 60.", name: LeaseContainerRequestBreakPeriod } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: breakPeriod - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Required for acquire. Specifies the duration - of the lease, in seconds, or negative one (-1) for a lease that - never expires.", name: leaseDuration } - java: { description: "Required for acquire. Specifies the duration of - the lease, in seconds, or negative one (-1) for a lease that never - expires.", name: leaseDuration } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id495 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: "Required for acquire. Specifies the duration - of the lease, in seconds, or negative one (-1) for a lease that - never expires.", name: LeaseContainerRequestLeaseDuration } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: leaseDuration - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Optional for acquire, required for change. Proposed - lease ID, in a GUID string format.", name: proposedLeaseId } - java: { description: "Optional for acquire, required for change. Proposed - lease ID, in a GUID string format.", name: proposedLeaseId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id740 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "Optional for acquire, required for change. - Proposed lease ID, in a GUID string format.", name: LeaseContainerRequestProposedLeaseId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: proposedLeaseId - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id008 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/default/containers/{containerName}/lease - uri: "{$host}" - signatureParameters: - - *id109 - - *id110 - - *id111 - - *id112 - responses: - - language: - default: - { description: OK -- Lease Container operation completed successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id581 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Lease Container response schema., - name: LeaseContainerResponse, - namespace: "", - } - java: { description: Lease Container response schema., name: LeaseContainerResponse } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Returned unique lease ID that must be included - with any request to delete the container, or to renew, change, or - release the lease.", name: leaseId } - java: { description: "Returned unique lease ID that must be included with - any request to delete the container, or to renew, change, or release - the lease.", name: leaseId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id741 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "Returned unique lease ID that must be included - with any request to delete the container, or to renew, change, or - release the lease.", name: LeaseContainerResponseLeaseId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: leaseId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Approximate time remaining in the lease period, - in seconds.", name: leaseTimeSeconds } - java: { description: "Approximate time remaining in the lease period, in - seconds.", name: leaseTimeSeconds } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id742 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "Approximate time remaining in the lease period, - in seconds.", name: LeaseContainerResponseLeaseTimeSeconds } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: leaseTimeSeconds - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id109 - - *id110 - - *id111 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id605 - apiVersions: - - { version: "1.0" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 1.0 - protocol: {} - type: STRING - - *id030 - - *id035 -info: { description: The Azure Storage Management API., title: StorageManagementClient } -language: - default: { description: "", name: StorageManagementClient } - java: { description: "", name: StorageManagementClient } -operationGroups: - - &id113 - $key: Operations - codeModel: *id001 - language: - default: { description: "", name: Operations } - java: { description: "", name: Operations } - operations: - - &id114 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - OperationsList: - parameters: { api-version: 2020-08-01-preview } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/OperationsList.json - responses: - "200": - body: - value: - - name: Microsoft.Storage/storageAccounts/write - display: { description: Creates a storage account with the specified - parameters or update the properties or tags or adds custom - domain for the specified storage account., operation: Create/Update - Storage Account, provider: Microsoft Storage, resource: Storage - Accounts } - - name: Microsoft.Storage/storageAccounts/delete - display: - { description: Deletes an existing storage account., operation: Delete - Storage Account, provider: Microsoft Storage, resource: Storage - Accounts } - - name: Microsoft.Storage/storageAccounts/listkeys/action - display: { description: Returns the access keys for the specified - storage account., operation: List Storage Account Keys, provider: Microsoft - Storage, resource: Storage Accounts } - - name: Microsoft.Storage/storageAccounts/regeneratekey/action - display: { description: Regenerates the access keys for the specified - storage account., operation: Regenerate Storage Account Keys, provider: Microsoft Storage, resource: Storage Accounts } - - name: Microsoft.Storage/checknameavailability/read - display: { description: Checks that account name is valid and is - not in use., operation: Check Name Availability, provider: Microsoft - Storage, resource: Name Availability } - - name: Microsoft.Storage/storageAccounts/read - display: { description: Returns the list of storage accounts or - gets the properties for the specified storage account., operation: List/Get - Storage Account(s), provider: Microsoft Storage, resource: Storage - Accounts } - - name: Microsoft.Storage/usages/read - display: { description: Returns the limit and the current usage - count for resources in the specified subscription, operation: Get - Subscription Usages, provider: Microsoft Storage, resource: Usage - Metrics } - - name: Microsoft.Storage/storageAccounts/listAccountSas/action - display: { description: Returns the Account SAS token for the specified - storage account., operation: Returns Storage Account SAS Token, provider: Microsoft Storage, resource: Storage Account SAS Token } - - name: Microsoft.Storage/storageAccounts/listServiceSas/action - display: { description: Storage Service SAS Token, operation: Returns - Storage Service SAS Token, provider: Microsoft Storage, resource: Returns - the Service SAS token for the specified storage account. } - - name: Microsoft.Storage/locations/deleteVirtualNetworkOrSubnets/action - display: { description: Notifies Microsoft.Storage that virtual - network or subnet is being deleted, operation: Delete virtual - network or subnets notifications, provider: Microsoft Storage, resource: Location } - - name: Microsoft.Storage/operations/read - display: - { - description: Polls the status of an asynchronous operation., - operation: Poll Asynchronous Operation, - provider: Microsoft - Storage, - resource: Operations, - } - - name: Microsoft.Storage/register/action - display: { description: Registers the subscription for the storage - resource provider and enables the creation of storage accounts., operation: Registers the Storage Resource Provider, provider: Microsoft - Storage, resource: Storage Resource Provider } - - name: Microsoft.Storage/skus/read - display: - { - description: Lists the Skus supported by Microsoft.Storage., - operation: List Skus, - provider: Microsoft Storage, - resource: Skus, - } - - name: Microsoft.Storage/storageAccounts/services/diagnosticSettings/write - display: { description: Create/Update storage account diagnostic - settings., operation: Create/Update Diagnostic Settings, provider: Microsoft - Storage, resource: Storage Accounts } - - name: Microsoft.Storage/storageAccounts/providers/Microsoft.Insights/metricDefinitions/read - display: - { - description: Get list of Microsoft Storage Metrics definitions., - operation: Get list of Microsoft Storage Metrics definitions, - provider: Microsoft Storage, - resource: Storage Accounts, - } - origin: system - properties: - serviceSpecification: - metricSpecifications: - - { - name: UsedCapacity, - aggregationType: Average, - category: Capacity, - displayDescription: Account used capacity, - displayName: Used - capacity, - fillGapWithZero: false, - resourceIdDimensionNameOverride: AccountResourceId, - unit: Bytes, - } - - name: Microsoft.Storage/storageAccounts/providers/Microsoft.Insights/diagnosticSettings/read - display: - { - description: Gets the diagnostic setting for the resource., - operation: Read diagnostic setting, - provider: Microsoft Storage, - resource: Storage Accounts, - } - origin: system - - name: Microsoft.Storage/storageAccounts/providers/Microsoft.Insights/diagnosticSettings/write - display: { description: Creates or updates the diagnostic setting - for the resource., operation: Write diagnostic setting, provider: Microsoft - Storage, resource: Storage Accounts } - origin: system - - name: Microsoft.Storage/storageAccounts/blobServices/providers/Microsoft.Insights/metricDefinitions/read - display: - { - description: Get list of Microsoft Storage Metrics definitions., - operation: Get list of Microsoft Storage Metrics definitions, - provider: Microsoft Storage, - resource: Blob service, - } - origin: system - properties: - serviceSpecification: - metricSpecifications: - - name: BlobCapacity - aggregationType: Average - category: Capacity - dimensions: - - { name: BlobType, displayName: Blob type } - displayDescription: The amount of storage used by the storage - account’s Blob service in bytes. - displayName: Blob Capacity - fillGapWithZero: false - unit: Bytes - - name: BlobCount - aggregationType: Average - category: Capacity - dimensions: - - { name: BlobType, displayName: Blob type } - displayDescription: The number of Blob in the storage account’s - Blob service. - displayName: Blob Count - fillGapWithZero: false - unit: Count - - { - name: ContainerCount, - aggregationType: Average, - category: Capacity, - displayDescription: The number of containers in the storage - account’s Blob service., - displayName: Blob Container Count, - fillGapWithZero: false, - unit: Count, - } - - name: BlobProvisionedSize - aggregationType: Average - category: Capacity - dimensions: - - { name: BlobType, displayName: Blob type } - displayDescription: The amount of storage provisioned in - the storage account’s Blob service in bytes. - displayName: Blob Provisioned Size - fillGapWithZero: false - unit: Bytes - - name: Microsoft.Storage/storageAccounts/blobServices/providers/Microsoft.Insights/diagnosticSettings/read - display: - { - description: Gets the diagnostic setting for the resource., - operation: Read diagnostic setting, - provider: Microsoft Storage, - resource: Blob service, - } - origin: system - - name: Microsoft.Storage/storageAccounts/blobServices/providers/Microsoft.Insights/diagnosticSettings/write - display: { description: Creates or updates the diagnostic setting - for the resource., operation: Write diagnostic setting, provider: Microsoft - Storage, resource: Blob service } - origin: system - - name: Microsoft.Storage/storageAccounts/tableServices/providers/Microsoft.Insights/metricDefinitions/read - display: - { - description: Get list of Microsoft Storage Metrics definitions., - operation: Get list of Microsoft Storage Metrics definitions, - provider: Microsoft Storage, - resource: Table service, - } - origin: system - properties: - serviceSpecification: - metricSpecifications: - - { - name: TableCapacity, - aggregationType: Average, - category: Capacity, - displayDescription: The amount of storage used by the storage - account’s Table service in bytes., - displayName: Table - Capacity, - fillGapWithZero: false, - unit: Bytes, - } - - { - name: TableCount, - aggregationType: Average, - category: Capacity, - displayDescription: The number of table in the storage account’s - Table service., - displayName: Table Count, - fillGapWithZero: false, - unit: Count, - } - - { - name: TableEntityCount, - aggregationType: Average, - category: Capacity, - displayDescription: The number of table entities in the - storage account’s Table service., - displayName: Table Entity - Count, - fillGapWithZero: false, - unit: Count, - } - - name: Microsoft.Storage/storageAccounts/tableServices/providers/Microsoft.Insights/diagnosticSettings/read - display: - { - description: Gets the diagnostic setting for the resource., - operation: Read diagnostic setting, - provider: Microsoft Storage, - resource: Table service, - } - origin: system - - name: Microsoft.Storage/storageAccounts/tableServices/providers/Microsoft.Insights/diagnosticSettings/write - display: { description: Creates or updates the diagnostic setting - for the resource., operation: Write diagnostic setting, provider: Microsoft - Storage, resource: Table service } - origin: system - - name: Microsoft.Storage/storageAccounts/queueServices/providers/Microsoft.Insights/metricDefinitions/read - display: - { - description: Get list of Microsoft Storage Metrics definitions., - operation: Get list of Microsoft Storage Metrics definitions, - provider: Microsoft Storage, - resource: Queue service, - } - origin: system - properties: - serviceSpecification: - metricSpecifications: - - { - name: QueueCapacity, - aggregationType: Average, - category: Capacity, - displayDescription: The amount of storage used by the storage - account’s Queue service in bytes., - displayName: Queue - Capacity, - fillGapWithZero: false, - unit: Bytes, - } - - { - name: QueueCount, - aggregationType: Average, - category: Capacity, - displayDescription: The number of queue in the storage account’s - Queue service., - displayName: Queue Count, - fillGapWithZero: false, - unit: Count, - } - - { - name: QueueMessageCount, - aggregationType: Average, - category: Capacity, - displayDescription: The approximate number of queue messages - in the storage account’s Queue service., - displayName: Queue - Message Count, - fillGapWithZero: false, - unit: Count, - } - - name: Microsoft.Storage/storageAccounts/queueServices/providers/Microsoft.Insights/diagnosticSettings/read - display: - { - description: Gets the diagnostic setting for the resource., - operation: Read diagnostic setting, - provider: Microsoft Storage, - resource: Queue service, - } - origin: system - - name: Microsoft.Storage/storageAccounts/queueServices/providers/Microsoft.Insights/diagnosticSettings/write - display: { description: Creates or updates the diagnostic setting - for the resource., operation: Write diagnostic setting, provider: Microsoft - Storage, resource: Queue service } - origin: system - - name: Microsoft.Storage/storageAccounts/fileServices/providers/Microsoft.Insights/metricDefinitions/read - display: - { - description: Get list of Microsoft Storage Metrics definitions., - operation: Get list of Microsoft Storage Metrics definitions, - provider: Microsoft Storage, - resource: File service, - } - origin: system - properties: - serviceSpecification: - metricSpecifications: - - { - name: FileCapacity, - aggregationType: Average, - category: Capacity, - displayDescription: The amount of storage used by the storage - account’s File service in bytes., - displayName: File Capacity, - fillGapWithZero: false, - unit: Bytes, - } - - { - name: FileProvisionedSize, - aggregationType: Average, - category: Capacity, - displayDescription: The amount of storage provisioned in - the storage account’s File service in bytes., - displayName: File - Provisioned Size, - fillGapWithZero: false, - unit: Bytes, - } - - { - name: FileCount, - aggregationType: Average, - category: Capacity, - displayDescription: The number of file in the storage account’s - File service., - displayName: File Count, - fillGapWithZero: false, - unit: Count, - } - - { - name: FileShareCount, - aggregationType: Average, - category: Capacity, - displayDescription: The number of file shares in the storage - account’s File service., - displayName: File Share Count, - fillGapWithZero: false, - unit: Count, - } - - name: Microsoft.Storage/storageAccounts/fileServices/providers/Microsoft.Insights/diagnosticSettings/read - display: - { - description: Gets the diagnostic setting for the resource., - operation: Read diagnostic setting, - provider: Microsoft Storage, - resource: File service, - } - origin: system - - name: Microsoft.Storage/storageAccounts/fileServices/providers/Microsoft.Insights/diagnosticSettings/write - display: { description: Creates or updates the diagnostic setting - for the resource., operation: Write diagnostic setting, provider: Microsoft - Storage, resource: File service } - origin: system - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: - { description: Lists all of the available Storage Rest API operations., name: List } - java: { description: Lists all of the available Storage Rest API operations., name: list } - operationGroup: *id113 - operationId: Operations_List - parameters: - - *id030 - - *id035 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id035 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id114 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: /providers/Microsoft.Storage/operations, - uri: "{$host}", - } - signatureParameters: [] - responses: - - language: - default: { description: OK. The request has succeeded., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id496 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: Result of the request to list Storage operations. - It contains a list of operations and a URL link to get the next set - of results., name: OperationListResult, namespace: "" } - java: { description: Result of the request to list Storage operations. It - contains a list of operations and a URL link to get the next set of - results., name: OperationListResult } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: List of Storage operations supported by the Storage - resource provider., name: value } - java: { description: List of Storage operations supported by the Storage - resource provider., name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id351 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id497 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Storage REST API operation definition., - name: Operation, - namespace: "", - } - java: - { description: Storage REST API operation definition., name: Operation } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: "Operation name: {provider}/{resource}/{operation}", - name: name, - } - java: - { - description: "Operation name: {provider}/{resource}/{operation}", - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id590 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "Operation name: {provider}/{resource}/{operation}", - name: OperationName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display metadata associated with the operation., - name: display, - } - java: - { - description: Display metadata associated with the operation., - name: display, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id498 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Display metadata associated with the operation., - name: OperationDisplay, - namespace: "", - } - java: - { - description: Display metadata associated with the operation., - name: OperationDisplay, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: "Service provider: Microsoft Storage.", - name: provider, - } - java: - { - description: "Service provider: Microsoft Storage.", - name: provider, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id591 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "Service provider: Microsoft Storage.", - name: OperationDisplayProvider, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: provider - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Resource on which the operation is performed - etc., name: resource } - java: { description: Resource on which the operation is performed - etc., name: resource } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id592 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Resource on which the operation is - performed etc., name: OperationDisplayResource } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resource - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Type of operation: get, read, delete, - etc.", name: operation } - java: - { - description: "Type of operation: get, read, delete, etc.", - name: operation, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id593 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "Type of operation: get, read, delete, - etc.", name: OperationDisplayOperation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: operation - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Description of the operation., - name: description, - } - java: - { - description: Description of the operation., - name: description, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id594 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Description of the operation., - name: OperationDisplayDescription, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: description - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: display - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The origin of operations., name: origin } - java: { description: The origin of operations., name: origin } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id595 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: The origin of operations., name: OperationOrigin } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: origin - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: "Properties of operation, include metric - specifications.", name: operationProperties } - java: - { - description: "Properties of operation, include metric specifications.", - name: operationProperties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id499 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: { description: "Properties of operation, include metric - specifications.", name: OperationProperties, namespace: "" } - java: - { - description: "Properties of operation, include metric specifications.", - name: OperationProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "One property of operation, include metric - specifications.", name: serviceSpecification } - java: { description: "One property of operation, include metric - specifications.", name: serviceSpecification } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id500 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "One property of operation, include - metric specifications.", name: ServiceSpecification, namespace: "" } - java: { description: "One property of operation, include metric - specifications.", name: ServiceSpecification } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Metric specifications of operation., - name: metricSpecifications, - } - java: - { - description: Metric specifications of operation., - name: metricSpecifications, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id350 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id501 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Metric specification of operation., - name: MetricSpecification, - namespace: "", - } - java: - { - description: Metric specification of operation., - name: MetricSpecification, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Name of metric specification., - name: name, - } - java: - { - description: Name of metric specification., - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id596 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Name of metric specification., - name: MetricSpecificationName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display name of metric specification., - name: displayName, - } - java: - { - description: Display name of metric specification., - name: displayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id597 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Display name of metric specification., - name: MetricSpecificationDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Display description of metric - specification., name: displayDescription } - java: { description: Display description of metric - specification., name: displayDescription } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id598 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Display description of metric - specification., name: MetricSpecificationDisplayDescription } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayDescription - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Unit could be Bytes or Count., - name: unit, - } - java: - { - description: Unit could be Bytes or Count., - name: unit, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id599 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Unit could be Bytes or Count., - name: MetricSpecificationUnit, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: unit - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Dimensions of blobs, including - blob type and access tier.", name: dimensions } - java: { description: "Dimensions of blobs, including - blob type and access tier.", name: dimensions } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id349 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id502 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: "Dimension of blobs, possibly - be blob type or access tier.", name: Dimension, namespace: "" } - java: - { description: "Dimension of blobs, possibly - be blob type or access tier.", name: Dimension } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display name of dimension., - name: name, - } - java: - { - description: Display name of dimension., - name: name, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id600 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Display name of dimension., - name: DimensionName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Display name of dimension., - name: displayName, - } - java: - { - description: Display name of dimension., - name: displayName, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id601 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Display name of dimension., - name: DimensionDisplayName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: displayName - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { description: "Dimensions of blobs, including - blob type and access tier.", name: MetricSpecificationDimensions } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: dimensions - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Aggregation type could be Average., - name: aggregationType, - } - java: - { - description: Aggregation type could be Average., - name: aggregationType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id602 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Aggregation type could be - Average., name: MetricSpecificationAggregationType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: aggregationType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The property to decide fill - gap with zero or not., name: fillGapWithZero } - java: { description: The property to decide fill gap - with zero or not., name: fillGapWithZero } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id393 - apiVersions: [] - language: - default: - { description: The property to decide fill - gap with zero or not., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: fillGapWithZero - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - "The category this metric specification - belong to, could be Capacity.", - name: category, - } - java: - { - description: - "The category this metric specification - belong to, could be Capacity.", - name: category, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id603 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "The category this metric - specification belong to, could be Capacity.", name: MetricSpecificationCategory } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: category - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Account Resource Id., - name: resourceIdDimensionNameOverride, - } - java: - { - description: Account Resource Id., - name: resourceIdDimensionNameOverride, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id604 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Account Resource Id., - name: MetricSpecificationResourceIdDimensionNameOverride, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resourceIdDimensionNameOverride - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: Metric specifications of operation., - name: ServiceSpecificationMetricSpecifications, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: metricSpecifications - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: serviceSpecification - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: List of Storage operations supported by the Storage - resource provider., name: OperationListResultValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - protocol: {} - - &id115 - $key: Skus - codeModel: *id001 - language: - default: { description: "", name: Skus } - java: { description: "", name: Skus } - operations: - - &id116 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - SkuList: - parameters: { api-version: 2020-08-01-preview, subscriptionId: "{subscription-id}" } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/SKUList.json - responses: - "200": - body: - value: - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "true" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus2(stage)] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southeastasia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [japaneast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [japanwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [northcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [centralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [northeurope] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [brazilsouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [australiaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [australiasoutheast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [southindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [centralindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westindia] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [canadaeast] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [canadacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westus2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "true" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [westcentralus] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uksouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [ukwest] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [koreacentral] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [koreasouth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uknorth] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "false" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [uksouth2] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [eastus2euap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_LRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_ZRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportsfileencryption, value: "true" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: Storage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Premium_LRS - capabilities: - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: Storage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Premium - - name: Standard_LRS - capabilities: - - { name: supportsarchivepreview, value: "false" } - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_GRS - capabilities: - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "true" } - kind: BlobStorage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - - name: Standard_RAGRS - capabilities: - - { name: supportschangenotification, value: "true" } - - { name: supportsfileencryption, value: "false" } - - { name: supportshoeboxcapacitymetrics, value: "false" } - - { name: supportsnetworkacls, value: "false" } - kind: BlobStorage - locations: [centraluseuap] - resourceType: storageAccounts - restrictions: [] - tier: Standard - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: { description: Lists the available SKUs supported by Microsoft.Storage - for given subscription., name: List } - java: { description: Lists the available SKUs supported by Microsoft.Storage - for given subscription., name: list } - operationGroup: *id115 - operationId: Skus_List - parameters: - - *id030 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id116 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus", - uri: "{$host}", - } - signatureParameters: [] - responses: - - language: - default: { description: OK -- List of storage SKUs in the given subscription - retrieved and returned successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id503 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The response from the List Storage SKUs operation., - name: StorageSkuListResult, - namespace: "", - } - java: - { - description: The response from the List Storage SKUs operation., - name: StorageSkuListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Get the list result of storage SKUs and their properties., - name: value, - } - java: - { - description: Get the list result of storage SKUs and their properties., - name: value, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id356 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id504 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Storage SKU and its properties, - name: SkuInformation, - namespace: "", - } - java: { description: Storage SKU and its properties, name: SkuInformation } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The SKU name. Required for account creation; - optional for update. Note that in older versions, SKU name was - called accountType.", name: name } - java: { description: "The SKU name. Required for account creation; - optional for update. Note that in older versions, SKU name was - called accountType.", name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id117 - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The SKU tier. This is based on the SKU name., - name: tier, - } - java: - { - description: The SKU tier. This is based on the SKU name., - name: tier, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id118 - serializedName: tier - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The type of the resource, usually it is - 'storageAccounts'.", name: resourceType } - java: - { - description: "The type of the resource, usually it is 'storageAccounts'.", - name: resourceType, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id606 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "The type of the resource, usually it is - 'storageAccounts'.", name: SkuInformationResourceType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: resourceType - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Indicates the type of storage account., name: kind } - java: - { description: Indicates the type of storage account., name: kind } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id119 - serializedName: kind - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The set of locations that the SKU is available. - This will be supported and registered Azure Geo Regions (e.g. - West US, East US, Southeast Asia, etc.).", name: locations } - java: { description: "The set of locations that the SKU is available. - This will be supported and registered Azure Geo Regions (e.g. - West US, East US, Southeast Asia, etc.).", name: locations } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id352 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id607 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: SkuInformationLocationsItem } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: "The set of locations that the SKU is available. - This will be supported and registered Azure Geo Regions (e.g. - West US, East US, Southeast Asia, etc.).", name: SkuInformationLocations } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: locations - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The capability information in the specified - SKU, including file encryption, network ACLs, change notification, - etc.", name: capabilities } - java: { description: "The capability information in the specified - SKU, including file encryption, network ACLs, change notification, - etc.", name: capabilities } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id353 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id505 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "The capability information in the specified - SKU, including file encryption, network ACLs, change notification, - etc.", name: SkuCapability, namespace: "" } - java: { description: "The capability information in the specified - SKU, including file encryption, network ACLs, change notification, - etc.", name: SkuCapability } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The name of capability, The capability - information in the specified SKU, including file encryption, - network ACLs, change notification, etc.", name: name } - java: { description: "The name of capability, The capability - information in the specified SKU, including file encryption, - network ACLs, change notification, etc.", name: name } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id608 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: "The name of capability, The capability - information in the specified SKU, including file encryption, - network ACLs, change notification, etc.", name: SkuCapabilityName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: A string value to indicate states of - given capability. Possibly 'true' or 'false'., name: value } - java: { description: A string value to indicate states of given - capability. Possibly 'true' or 'false'., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id609 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: A string value to indicate states - of given capability. Possibly 'true' or 'false'., name: SkuCapabilityValue } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: "The capability information in the specified - SKU, including file encryption, network ACLs, change notification, - etc.", name: SkuInformationCapabilities } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: capabilities - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The restrictions because of which SKU cannot - be used. This is empty if there are no restrictions., name: restrictions } - java: { description: The restrictions because of which SKU cannot - be used. This is empty if there are no restrictions., name: restrictions } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id355 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id506 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The restriction because of which SKU - cannot be used., name: Restriction, namespace: "" } - java: { description: The restriction because of which SKU cannot - be used., name: Restriction } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The type of restrictions. As of now - only possible value for this is location., name: type } - java: { description: The type of restrictions. As of now only - possible value for this is location., name: type } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id610 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: The type of restrictions. As of now - only possible value for this is location., name: RestrictionType } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The value of restrictions. If the restriction - type is set to location. This would be different locations - where the SKU is restricted., name: values } - java: - { description: The value of restrictions. If the restriction - type is set to location. This would be different locations - where the SKU is restricted., name: values } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id354 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id611 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: RestrictionValuesItem } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The value of restrictions. If the - restriction type is set to location. This would be different - locations where the SKU is restricted., name: RestrictionValues } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: values - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The reason for the restriction. As - of now this can be "QuotaId" or "NotAvailableForSubscription". - Quota Id is set when the SKU has requiredQuotas parameter - as the subscription does not belong to that quota. The - "NotAvailableForSubscription" is related to capacity at - DC., name: reasonCode } - java: { description: The reason for the restriction. As of - now this can be "QuotaId" or "NotAvailableForSubscription". - Quota Id is set when the SKU has requiredQuotas parameter - as the subscription does not belong to that quota. The - "NotAvailableForSubscription" is related to capacity at - DC., name: reasonCode } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id420 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: QUOTA_Id } - value: QuotaId - - language: - default: - { - description: "", - name: NOT_AVAILABLE_FOR_SUBSCRIPTION, - } - value: NotAvailableForSubscription - language: - default: { description: The reason for the restriction. As - of now this can be "QuotaId" or "NotAvailableForSubscription". - Quota Id is set when the SKU has requiredQuotas parameter - as the subscription does not belong to that quota. The - "NotAvailableForSubscription" is related to capacity - at DC., name: ReasonCode } - java: { description: The reason for the restriction. As of - now this can be "QuotaId" or "NotAvailableForSubscription". - Quota Id is set when the SKU has requiredQuotas parameter - as the subscription does not belong to that quota. The - "NotAvailableForSubscription" is related to capacity - at DC., name: ReasonCode } - protocol: {} - type: CHOICE - serializedName: reasonCode - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: The restrictions because of which SKU cannot - be used. This is empty if there are no restrictions., name: SkuInformationRestrictions } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: restrictions - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: Get the list result of storage SKUs and their - properties., name: StorageSkuListResultValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - protocol: {} - - &id120 - $key: StorageAccounts - codeModel: *id001 - language: - default: { description: "", name: StorageAccounts } - java: { description: "", name: StorageAccounts } - operations: - - &id121 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountCheckNameAvailability: - parameters: - accountName: { name: sto3363, type: Microsoft.Storage/storageAccounts } - api-version: 2020-08-01-preview - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountCheckNameAvailability.json - responses: - "200": - body: { nameAvailable: true } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Checks that the storage account name is valid and is - not already in use., name: CheckNameAvailability } - java: { description: Checks that the storage account name is valid and is not - already in use., name: checkNameAvailability } - operationGroup: *id120 - operationId: StorageAccounts_CheckNameAvailability - parameters: - - *id030 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id035 - - *id031 - - &id122 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName } - java: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName } - nullable: false - operation: *id121 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id507 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The parameters used to check the availability of - the storage account name., name: StorageAccountCheckNameAvailabilityParameters, namespace: "" } - java: { description: The parameters used to check the availability of the - storage account name., name: StorageAccountCheckNameAvailabilityParameters } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The storage account name., name: name } - java: { description: The storage account name., name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id612 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The storage account name., - name: StorageAccountCheckNameAvailabilityParametersName, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: "The type of resource, Microsoft.Storage/storageAccounts", - name: type, - } - java: - { - description: "The type of resource, Microsoft.Storage/storageAccounts", - name: type, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ConstantSchema &id450 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "The type of resource, Microsoft.Storage/storageAccounts", - name: Type, - } - protocol: {} - type: CONSTANT - value: { value: Microsoft.Storage/storageAccounts } - valueType: *id010 - serializedName: type - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id121 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability - uri: "{$host}" - signatureParameters: - - *id122 - responses: - - language: - default: { description: OK -- Operation to check the storage account name availability - was successful., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id508 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The CheckNameAvailability operation response., - name: CheckNameAvailabilityResult, - namespace: "", - } - java: - { - description: The CheckNameAvailability operation response., - name: CheckNameAvailabilityResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Gets a boolean value that indicates whether the - name is available for you to use. If true, the name is available. - If false, the name has already been taken or is invalid and cannot - be used.", name: nameAvailable } - java: { description: "Gets a boolean value that indicates whether the name - is available for you to use. If true, the name is available. If false, - the name has already been taken or is invalid and cannot be used.", name: nameAvailable } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id394 - apiVersions: [] - language: - default: { description: "Gets a boolean value that indicates whether - the name is available for you to use. If true, the name is available. - If false, the name has already been taken or is invalid and cannot - be used.", name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: nameAvailable - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the reason that a storage account name could - not be used. The Reason element is only returned if NameAvailable - is false., name: reason } - java: { description: Gets the reason that a storage account name could - not be used. The Reason element is only returned if NameAvailable - is false., name: reason } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id582 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: ACCOUNT_NAME_INVALID } - value: AccountNameInvalid - - language: - default: { description: "", name: ALREADY_EXISTS } - value: AlreadyExists - language: - default: { description: Gets the reason that a storage account name could - not be used. The Reason element is only returned if NameAvailable - is false., name: Reason } - java: { description: Gets the reason that a storage account name could - not be used. The Reason element is only returned if NameAvailable - is false., name: Reason } - protocol: {} - type: SEALED_CHOICE - serializedName: reason - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets an error message explaining the Reason value - in more detail., name: message } - java: { description: Gets an error message explaining the Reason value - in more detail., name: message } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id613 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Gets an error message explaining the Reason value - in more detail., name: CheckNameAvailabilityResultMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - - &id123 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - NfsV3AccountCreate: - parameters: - accountName: sto4445 - api-version: "2021-01-01" - parameters: - kind: BlockBlobStorage - location: eastus - properties: - isHnsEnabled: true - isNfsV3Enabled: true - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - virtualNetworkRules: - - { - id: "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12", - } - supportsHttpsTrafficOnly: false - sku: { name: Premium_LRS } - resourceGroupName: res9101 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/NfsV3AccountCreate.json - responses: - "200": - body: - name: sto4445 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Storage/storageAccounts/sto4445 - kind: BlockBlobStorage - location: eastus - properties: - isHnsEnabled: true - isNfsV3Enabled: true - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - virtualNetworkRules: - - { - id: "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Network/virtualNetworks/net123/subnets/subnet12", - } - supportsHttpsTrafficOnly: false - sku: { name: Premium_LRS, tier: Premium } - "202": {} - StorageAccountCreate: - parameters: - accountName: sto4445 - api-version: 2020-08-01-preview - parameters: - extendedLocation: { name: losangeles001, type: EdgeZone } - kind: Storage - location: eastus - properties: - allowBlobPublicAccess: false - allowSharedKeyAccess: true - encryption: - keySource: Microsoft.Storage - requireInfrastructureEncryption: false - services: - blob: { enabled: true, keyType: Account } - file: { enabled: true, keyType: Account } - isHnsEnabled: true - minimumTlsVersion: TLS1_2 - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - sku: { name: Standard_GRS } - tags: { key1: value1, key2: value2 } - resourceGroupName: res9101 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountCreate.json - responses: - "200": - body: - name: sto4445 - type: Microsoft.Storage/storageAccounts - extendedLocation: { name: losangeles001, type: EdgeZone } - id: /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Storage/storageAccounts/sto4445 - kind: Storage - location: eastus - properties: - allowBlobPublicAccess: false - allowSharedKeyAccess: true - creationTime: "2017-05-24T13:25:33.4863236Z" - encryption: - keySource: Microsoft.Storage - requireInfrastructureEncryption: false - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - isHnsEnabled: true - minimumTlsVersion: TLS1_2 - primaryEndpoints: - blob: https://sto4445.blob.core.windows.net/ - dfs: https://sto4445.dfs.core.windows.net/ - file: https://sto4445.file.core.windows.net/ - internetEndpoints: - { - blob: "https://sto4445-internetrouting.blob.core.windows.net/", - dfs: "https://sto4445-internetrouting.dfs.core.windows.net/", - file: "https://sto4445-internetrouting.file.core.windows.net/", - web: "https://sto4445-internetrouting.web.core.windows.net/", - } - microsoftEndpoints: - { - blob: "https://sto4445-microsoftrouting.blob.core.windows.net/", - dfs: "https://sto4445-microsoftrouting.dfs.core.windows.net/", - file: "https://sto4445-microsoftrouting.file.core.windows.net/", - queue: "https://sto4445-microsoftrouting.queue.core.windows.net/", - table: "https://sto4445-microsoftrouting.table.core.windows.net/", - web: "https://sto4445-microsoftrouting.web.core.windows.net/", - } - queue: https://sto4445.queue.core.windows.net/ - table: https://sto4445.table.core.windows.net/ - web: https://sto4445.web.core.windows.net/ - primaryLocation: eastus2euap - provisioningState: Succeeded - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: true - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - "202": {} - StorageAccountCreateUserAssignedEncryptionIdentityWithCMK: - parameters: - accountName: sto4445 - api-version: "2021-01-01" - parameters: - identity: - type: UserAssigned - userAssignedIdentities: - /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}: - {} - kind: Storage - location: eastus - properties: - encryption: - identity: - { - userAssignedIdentity: "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", - } - keySource: Microsoft.Keyvault - keyvaultproperties: - { - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - } - services: - blob: { enabled: true, keyType: Account } - file: { enabled: true, keyType: Account } - sku: { name: Standard_LRS } - resourceGroupName: res9101 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountCreateUserAssignedEncryptionIdentityWithCMK.json - responses: - "200": - body: - name: sto4445 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Storage/storageAccounts/sto4445 - identity: - type: UserAssigned - userAssignedIdentities: - /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}: - { - clientId: fbaa6278-1ecc-415c-819f-6e2058d3acb5, - principalId: 8d823284-1060-42a5-9ec4-ed3d831e24d7, - } - kind: StorageV2 - location: eastus - properties: - accessTier: Hot - creationTime: "2020-12-15T00:43:14.0839093Z" - encryption: - identity: - { - userAssignedIdentity: "/subscriptions/{subscription-id}/resourcegroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", - } - keySource: Microsoft.Keyvault - keyvaultproperties: - { - currentVersionedKeyIdentifier: "https://myvault8569.vault.azure.net/keys/wrappingKey/0682afdd9c104f4285df20107e956cad", - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - lastKeyRotationTimestamp: "2019-12-13T20:36:23.7023290Z", - } - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2020-12-15T00:43:14.1739587Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2020-12-15T00:43:14.1739587Z", - } - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - virtualNetworkRules: [] - primaryEndpoints: - { - blob: "https://sto4445.blob.core.windows.net/", - dfs: "https://sto4445.dfs.core.windows.net/", - file: "https://sto4445.file.core.windows.net/", - queue: "https://sto4445.queue.core.windows.net/", - table: "https://sto4445.table.core.windows.net/", - web: "https://sto4445.web.core.windows.net/", - } - primaryLocation: eastus - privateEndpointConnections: [] - provisioningState: Succeeded - statusOfPrimary: available - supportsHttpsTrafficOnly: true - sku: { name: Standard_LRS, tier: Standard } - tags: {} - "202": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsSkipUrlEncoding: false - language: - default: { description: "Asynchronously creates a new storage account with the - specified parameters. If an account is already created and a subsequent - create request is issued with different properties, the account properties - will be updated. If an account is already created and a subsequent create - or update request is issued with the exact same set of properties, the request - will succeed.", name: Create } - java: { description: "Asynchronously creates a new storage account with the specified - parameters. If an account is already created and a subsequent create request - is issued with different properties, the account properties will be updated. - If an account is already created and a subsequent create or update request - is issued with the exact same set of properties, the request will succeed.", name: create } - operationGroup: *id120 - operationId: StorageAccounts_Create - parameters: - - *id030 - - &id124 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id123 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id125 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id123 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id124 - - *id125 - - *id035 - - *id031 - - &id141 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for the created account., - name: parameters, - } - java: - { - description: The parameters to provide for the created account., - name: parameters, - } - nullable: false - operation: *id123 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id509 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The parameters used when creating a storage account., - name: StorageAccountCreateParameters, - namespace: "", - } - java: - { - description: The parameters used when creating a storage account., - name: StorageAccountCreateParameters, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required. Gets or sets the SKU name., name: sku } - java: { description: Required. Gets or sets the SKU name., name: sku } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id126 - serializedName: sku - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Required. Indicates the type of storage account., - name: kind, - } - java: - { - description: Required. Indicates the type of storage account., - name: kind, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: *id119 - serializedName: kind - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Required. Gets or sets the location of the resource. - This will be one of the supported and registered Azure Geo Regions - (e.g. West US, East US, Southeast Asia, etc.). The geo region of - a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed.", name: location } - java: { description: "Required. Gets or sets the location of the resource. - This will be one of the supported and registered Azure Geo Regions - (e.g. West US, East US, Southeast Asia, etc.). The geo region of - a resource cannot be changed once it is created, but if an identical - geo region is specified on update, the request will succeed.", name: location } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id614 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "Required. Gets or sets the location of the - resource. This will be one of the supported and registered Azure - Geo Regions (e.g. West US, East US, Southeast Asia, etc.). The - geo region of a resource cannot be changed once it is created, - but if an identical geo region is specified on update, the request - will succeed.", name: StorageAccountCreateParametersLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: location - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Optional. Set the extended location of the resource. - If not set, the storage account will be created in Azure main region. - Otherwise it will be created in the specified extended location", name: extendedLocation } - java: { description: "Optional. Set the extended location of the resource. - If not set, the storage account will be created in Azure main region. - Otherwise it will be created in the specified extended location", name: extendedLocation } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id127 - serializedName: extendedLocation - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets or sets a list of key value pairs that describe - the resource. These tags can be used for viewing and grouping this - resource (across resource groups). A maximum of 15 tags can be provided - for a resource. Each tag must have a key with a length no greater - than 128 characters and a value with a length no greater than 256 - characters., name: tags } - java: { description: Gets or sets a list of key value pairs that describe - the resource. These tags can be used for viewing and grouping this - resource (across resource groups). A maximum of 15 tags can be provided - for a resource. Each tag must have a key with a length no greater - than 128 characters and a value with a length no greater than 256 - characters., name: tags } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id477 - apiVersions: [] - elementType: *id032 - language: - default: { description: Gets or sets a list of key value pairs that - describe the resource. These tags can be used for viewing and - grouping this resource (across resource groups). A maximum of - 15 tags can be provided for a resource. Each tag must have a key - with a length no greater than 128 characters and a value with - a length no greater than 256 characters., name: StorageAccountCreateParametersTags } - java: { description: Gets or sets a list of key value pairs that describe - the resource. These tags can be used for viewing and grouping - this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key with a length - no greater than 128 characters and a value with a length no greater - than 256 characters., name: StorageAccountCreateParametersTags } - protocol: {} - type: DICTIONARY - serializedName: tags - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The identity of the resource., name: identity } - java: { description: The identity of the resource., name: identity } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id128 - serializedName: identity - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: The parameters used to create the storage account., - name: properties, - } - java: - { - description: The parameters used to create the storage account., - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id511 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { - description: The parameters used to create the storage account., - name: StorageAccountPropertiesCreateParameters, - namespace: "", - } - java: - { - description: The parameters used to create the storage account., - name: StorageAccountPropertiesCreateParameters, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "User domain assigned to the storage account. - Name is the CNAME source. Only one custom domain is supported - per storage account at this time. To clear the existing custom - domain, use an empty string for the custom domain name property.", name: customDomain } - java: { description: "User domain assigned to the storage account. - Name is the CNAME source. Only one custom domain is supported - per storage account at this time. To clear the existing custom - domain, use an empty string for the custom domain name property.", name: customDomain } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id129 - serializedName: customDomain - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Not applicable. Azure Storage encryption - is enabled for all storage accounts and cannot be disabled., name: encryption } - java: { description: Not applicable. Azure Storage encryption is - enabled for all storage accounts and cannot be disabled., name: encryption } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id130 - serializedName: encryption - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Network rule set, name: networkRuleSet } - java: { description: Network rule set, name: networkRuleSet } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id131 - serializedName: networkAcls - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required for storage accounts where kind - = BlobStorage. The access tier used for billing., name: accessTier } - java: - { - description: - Required for storage accounts where kind = BlobStorage. - The access tier used for billing., - name: accessTier, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id132 - serializedName: accessTier - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Provides the identity based authentication - settings for Azure Files., name: azureFilesIdentityBasedAuthentication } - java: - { description: Provides the identity based authentication settings - for Azure Files., name: azureFilesIdentityBasedAuthentication } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id133 - serializedName: azureFilesIdentityBasedAuthentication - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Allows https traffic only to storage service - if sets to true. The default value is true since API version - 2019-04-01., name: enableHttpsTrafficOnly } - java: { description: Allows https traffic only to storage service - if sets to true. The default value is true since API version - 2019-04-01., name: enableHttpsTrafficOnly } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id398 - apiVersions: [] - language: - default: { description: Allows https traffic only to storage service - if sets to true. The default value is true since API version - 2019-04-01., name: EnableHttpsTrafficOnly } - protocol: {} - type: BOOLEAN - serializedName: supportsHttpsTrafficOnly - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Account HierarchicalNamespace enabled if - sets to true., name: IsHnsEnabled } - java: { description: Account HierarchicalNamespace enabled if sets - to true., name: isHnsEnabled } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id134 - serializedName: isHnsEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Allow large file shares if sets to Enabled. - It cannot be disabled once it is enabled., name: largeFileSharesState } - java: { description: Allow large file shares if sets to Enabled. - It cannot be disabled once it is enabled., name: largeFileSharesState } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id135 - serializedName: largeFileSharesState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Maintains information about the network routing - choice opted by the user for data transfer, name: routingPreference } - java: { description: Maintains information about the network routing - choice opted by the user for data transfer, name: routingPreference } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id136 - serializedName: routingPreference - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Allow or disallow public access to all blobs - or containers in the storage account. The default interpretation - is true for this property., name: allowBlobPublicAccess } - java: { description: Allow or disallow public access to all blobs - or containers in the storage account. The default interpretation - is true for this property., name: allowBlobPublicAccess } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id137 - serializedName: allowBlobPublicAccess - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Set the minimum TLS version to be permitted - on requests to storage. The default interpretation is TLS 1.0 - for this property., name: minimumTlsVersion } - java: { description: Set the minimum TLS version to be permitted - on requests to storage. The default interpretation is TLS 1.0 - for this property., name: minimumTlsVersion } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id138 - serializedName: minimumTlsVersion - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Indicates whether the storage account permits - requests to be authorized with the account access key via Shared - Key. If false, then all requests, including shared access signatures, - must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true.", name: allowSharedKeyAccess } - java: { description: "Indicates whether the storage account permits - requests to be authorized with the account access key via Shared - Key. If false, then all requests, including shared access signatures, - must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true.", name: allowSharedKeyAccess } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id139 - serializedName: allowSharedKeyAccess - - apiVersions: [] - isDiscriminator: false - language: - default: { description: NFS 3.0 protocol support enabled if set to - true., name: enableNfsV3 } - java: - { - description: NFS 3.0 protocol support enabled if set to true., - name: enableNfsV3, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id140 - serializedName: isNfsV3Enabled - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id123 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName} - uri: "{$host}" - signatureParameters: - - *id124 - - *id125 - - *id141 - responses: - - language: - default: { description: OK -- returned when the storage account was already - created from a previous request with the same properties specified in - the request body., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id142 - - language: - default: { description: Accepted -- Create or update request accepted; operation - will complete asynchronously., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - signatureParameters: - - *id124 - - *id125 - - &id143 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountDelete: - parameters: - { - accountName: sto2434, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res4228, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountDelete.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes a storage account in Microsoft Azure., name: Delete } - java: { description: Deletes a storage account in Microsoft Azure., name: delete } - operationGroup: *id120 - operationId: StorageAccounts_Delete - parameters: - - *id030 - - &id144 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id143 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id145 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id143 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id144 - - *id145 - - *id035 - - *id031 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", - uri: "{$host}", - } - signatureParameters: - - *id144 - - *id145 - responses: - - language: - default: { description: OK -- storage account deleted successfully., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: - { description: NoContent -- account does not exist in the subscription., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id144 - - *id145 - - &id146 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountGetProperties: - parameters: - { - accountName: sto8596, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res9407, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountGetProperties.json - responses: - "200": - body: - name: sto8596 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596 - kind: Storage - location: eastus2(stage) - properties: - creationTime: "2017-06-01T02:42:41.7633306Z" - encryption: - keySource: Microsoft.Storage - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - geoReplicationStats: - { canFailover: true, lastSyncTime: "2018-10-30T00:25:34Z", status: Live } - isHnsEnabled: true - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - resourceAccessRules: - - { - resourceId: /subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - virtualNetworkRules: [] - primaryEndpoints: - blob: https://sto8596.blob.core.windows.net/ - dfs: https://sto8596.dfs.core.windows.net/ - file: https://sto8596.file.core.windows.net/ - internetEndpoints: - { - blob: "https://sto8596-internetrouting.blob.core.windows.net/", - dfs: "https://sto8596-internetrouting.dfs.core.windows.net/", - file: "https://sto8596-internetrouting.file.core.windows.net/", - web: "https://sto8596-internetrouting.web.core.windows.net/", - } - microsoftEndpoints: - { - blob: "https://sto8596-microsoftrouting.blob.core.windows.net/", - dfs: "https://sto8596-microsoftrouting.dfs.core.windows.net/", - file: "https://sto8596-microsoftrouting.file.core.windows.net/", - queue: "https://sto8596-microsoftrouting.queue.core.windows.net/", - table: "https://sto8596-microsoftrouting.table.core.windows.net/", - web: "https://sto8596-microsoftrouting.web.core.windows.net/", - } - queue: https://sto8596.queue.core.windows.net/ - table: https://sto8596.table.core.windows.net/ - web: https://sto8596.web.core.windows.net/ - primaryLocation: eastus2(stage) - provisioningState: Succeeded - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - secondaryLocation: northcentralus(stage) - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - StorageAccountGetPropertiesCMKEnabled: - parameters: - { - accountName: sto8596, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res9407, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountGetPropertiesCMKEnabled.json - responses: - "200": - body: - name: sto8596 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596 - identity: - { - type: SystemAssigned, - principalId: 911871cc-ffd1-4fc4-ac11-7a316433ea66, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - kind: Storage - location: eastus2(stage) - properties: - creationTime: "2017-06-01T02:42:41.7633306Z" - encryption: - keySource: Microsoft.Keyvault - keyvaultproperties: - { - currentVersionedKeyIdentifier: "https://myvault8569.vault.azure.net/keys/wrappingKey/0682afdd9c104f4285df20107e956cad", - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - lastKeyRotationTimestamp: "2019-12-13T20:36:23.7023290Z", - } - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - geoReplicationStats: - { canFailover: true, lastSyncTime: "2018-10-30T00:25:34Z", status: Live } - isHnsEnabled: true - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - resourceAccessRules: [] - virtualNetworkRules: [] - primaryEndpoints: - blob: https://sto8596.blob.core.windows.net/ - dfs: https://sto8596.dfs.core.windows.net/ - file: https://sto8596.file.core.windows.net/ - internetEndpoints: - { - blob: "https://sto8596-internetrouting.blob.core.windows.net/", - dfs: "https://sto8596-internetrouting.dfs.core.windows.net/", - file: "https://sto8596-internetrouting.file.core.windows.net/", - web: "https://sto8596-internetrouting.web.core.windows.net/", - } - microsoftEndpoints: - { - blob: "https://sto8596-microsoftrouting.blob.core.windows.net/", - dfs: "https://sto8596-microsoftrouting.dfs.core.windows.net/", - file: "https://sto8596-microsoftrouting.file.core.windows.net/", - queue: "https://sto8596-microsoftrouting.queue.core.windows.net/", - table: "https://sto8596-microsoftrouting.table.core.windows.net/", - web: "https://sto8596-microsoftrouting.web.core.windows.net/", - } - queue: https://sto8596.queue.core.windows.net/ - table: https://sto8596.table.core.windows.net/ - web: https://sto8596.web.core.windows.net/ - primaryLocation: eastus2(stage) - provisioningState: Succeeded - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - secondaryLocation: northcentralus(stage) - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Returns the properties for the specified storage account - including but not limited to name, SKU name, location, and account status. - The ListKeys operation should be used to retrieve storage keys.", name: GetProperties } - java: { description: "Returns the properties for the specified storage account - including but not limited to name, SKU name, location, and account status. - The ListKeys operation should be used to retrieve storage keys.", name: getByResourceGroup } - operationGroup: *id120 - operationId: StorageAccounts_GetProperties - parameters: - - *id030 - - &id147 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id146 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id148 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id146 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id149 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "May be used to expand the properties within account's - properties. By default, data is not included when fetching properties. - Currently we only support geoReplicationStats and blobRestoreStatus.", name: expand, serializedName: $expand } - java: { description: "May be used to expand the properties within account's - properties. By default, data is not included when fetching properties. - Currently we only support geoReplicationStats and blobRestoreStatus.", name: expand, serializedName: $expand } - nullable: false - operation: *id146 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id585 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: GEO_REPLICATION_STATS } - value: geoReplicationStats - - language: - default: { description: "", name: BLOB_RESTORE_STATUS } - value: blobRestoreStatus - language: - default: { description: "", name: StorageAccountExpand } - java: { description: "", name: StorageAccountExpand } - protocol: {} - type: SEALED_CHOICE - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id147 - - *id148 - - *id035 - - *id031 - - *id149 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id146 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}", - uri: "{$host}", - } - signatureParameters: - - *id147 - - *id148 - - *id149 - responses: - - language: - default: { description: OK -- properties retrieved successfully for the storage - account., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id142 - signatureParameters: - - *id147 - - *id148 - - *id149 - - &id150 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountEnableAD: - parameters: - accountName: sto8596 - api-version: 2020-08-01-preview - monitor: "true" - parameters: - properties: - azureFilesIdentityBasedAuthentication: - activeDirectoryProperties: - { - azureStorageSid: S-1-5-21-2400535526-2334094090-2402026252-0012, - domainGuid: aebfc118-9fa9-4732-a21f-d98e41a77ae1, - domainName: adtest.com, - domainSid: S-1-5-21-2400535526-2334094090-2402026252, - forestName: adtest.com, - netBiosDomainName: adtest.com, - } - directoryServiceOptions: AD - resourceGroupName: res9407 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountEnableAD.json - responses: - "200": - body: - name: sto8596 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596 - kind: Storage - location: eastus2(stage) - properties: - azureFilesIdentityBasedAuthentication: - activeDirectoryProperties: - { - azureStorageSid: S-1-5-21-2400535526-2334094090-2402026252-0012, - domainGuid: aebfc118-9fa9-4732-a21f-d98e41a77ae1, - domainName: adtest.com, - domainSid: S-1-5-21-2400535526-2334094090-2402026252, - forestName: adtest.com, - netBiosDomainName: adtest.com, - } - directoryServiceOptions: AD - creationTime: "2017-06-01T02:42:41.7633306Z" - primaryEndpoints: - { - blob: "https://sto8596.blob.core.windows.net/", - dfs: "https://sto8596.dfs.core.windows.net/", - file: "https://sto8596.file.core.windows.net/", - queue: "https://sto8596.queue.core.windows.net/", - table: "https://sto8596.table.core.windows.net/", - web: "https://sto8596.web.core.windows.net/", - } - primaryLocation: eastus2(stage) - provisioningState: Succeeded - secondaryLocation: northcentralus(stage) - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - StorageAccountEnableCMK: - parameters: - accountName: sto8596 - api-version: 2020-08-01-preview - monitor: "true" - parameters: - properties: - encryption: - keySource: Microsoft.Keyvault - keyvaultproperties: - { - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - } - services: - blob: { enabled: true, keyType: Account } - file: { enabled: true, keyType: Account } - resourceGroupName: res9407 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountEnableCMK.json - responses: - "200": - body: - name: sto8596 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596 - identity: - { - type: SystemAssigned, - principalId: 911871cc-ffd1-4fc4-ac11-7a316433ea66, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - kind: Storage - location: eastus2(stage) - properties: - creationTime: "2017-06-01T02:42:41.7633306Z" - encryption: - keySource: Microsoft.Keyvault - keyvaultproperties: - { - currentVersionedKeyIdentifier: "https://myvault8569.vault.azure.net/keys/wrappingKey/0682afdd9c104f4285df20107e956cad", - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - lastKeyRotationTimestamp: "2019-12-13T20:36:23.7023290Z", - } - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - primaryEndpoints: - { - blob: "https://sto8596.blob.core.windows.net/", - dfs: "https://sto8596.dfs.core.windows.net/", - file: "https://sto8596.file.core.windows.net/", - queue: "https://sto8596.queue.core.windows.net/", - table: "https://sto8596.table.core.windows.net/", - web: "https://sto8596.web.core.windows.net/", - } - primaryLocation: eastus2(stage) - provisioningState: Succeeded - secondaryLocation: northcentralus(stage) - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - StorageAccountUpdate: - parameters: - accountName: sto8596 - api-version: 2020-08-01-preview - monitor: "true" - parameters: - properties: - allowBlobPublicAccess: false - allowSharedKeyAccess: true - encryption: - keySource: Microsoft.Storage - services: - blob: { enabled: true, keyType: Account } - file: { enabled: true, keyType: Account } - minimumTlsVersion: TLS1_2 - networkAcls: - defaultAction: Allow - resourceAccessRules: - - { - resourceId: /subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - resourceGroupName: res9407 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountUpdate.json - responses: - "200": - body: - name: sto8596 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596 - kind: Storage - location: eastus2(stage) - properties: - allowBlobPublicAccess: false - allowSharedKeyAccess: true - creationTime: "2017-06-01T02:42:41.7633306Z" - encryption: - keySource: Microsoft.Storage - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - isHnsEnabled: true - minimumTlsVersion: TLS1_2 - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - resourceAccessRules: - - { - resourceId: /subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - virtualNetworkRules: [] - primaryEndpoints: - blob: https://sto8596.blob.core.windows.net/ - dfs: https://sto8596.dfs.core.windows.net/ - file: https://sto8596.file.core.windows.net/ - internetEndpoints: - { - blob: "https://sto8596-internetrouting.blob.core.windows.net/", - dfs: "https://sto8596-internetrouting.dfs.core.windows.net/", - file: "https://sto8596-internetrouting.file.core.windows.net/", - web: "https://sto8596-internetrouting.web.core.windows.net/", - } - microsoftEndpoints: - { - blob: "https://sto8596-microsoftrouting.blob.core.windows.net/", - dfs: "https://sto8596-microsoftrouting.dfs.core.windows.net/", - file: "https://sto8596-microsoftrouting.file.core.windows.net/", - queue: "https://sto8596-microsoftrouting.queue.core.windows.net/", - table: "https://sto8596-microsoftrouting.table.core.windows.net/", - web: "https://sto8596-microsoftrouting.web.core.windows.net/", - } - queue: https://sto8596.queue.core.windows.net/ - table: https://sto8596.table.core.windows.net/ - web: https://sto8596.web.core.windows.net/ - primaryLocation: eastus2(stage) - provisioningState: Succeeded - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - secondaryLocation: northcentralus(stage) - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK: - parameters: - accountName: sto4445 - api-version: "2021-01-01" - parameters: - identity: - type: UserAssigned - userAssignedIdentities: - /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}: - {} - kind: Storage - properties: - encryption: - identity: - { - userAssignedIdentity: "/subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", - } - keySource: Microsoft.Keyvault - keyvaultproperties: - { - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - } - services: - blob: { enabled: true, keyType: Account } - file: { enabled: true, keyType: Account } - sku: { name: Standard_LRS } - resourceGroupName: res9101 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountUpdateUserAssignedEncryptionIdentityWithCMK.json - responses: - "200": - body: - name: sto4445 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.Storage/storageAccounts/sto4445 - identity: - type: UserAssigned - userAssignedIdentities: - /subscriptions/{subscription-id}/resourceGroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}: - { - clientId: fbaa6278-1ecc-415c-819f-6e2058d3acb5, - principalId: 8d823284-1060-42a5-9ec4-ed3d831e24d7, - } - kind: StorageV2 - location: eastus - properties: - accessTier: Hot - creationTime: "2020-12-15T00:43:14.0839093Z" - encryption: - identity: - { - userAssignedIdentity: "/subscriptions/{subscription-id}/resourcegroups/res9101/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{managed-identity-name}", - } - keySource: Microsoft.Keyvault - keyvaultproperties: - { - currentVersionedKeyIdentifier: "https://myvault8569.vault.azure.net/keys/wrappingKey/0682afdd9c104f4285df20107e956cad", - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - lastKeyRotationTimestamp: "2019-12-13T20:36:23.7023290Z", - } - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2020-12-15T00:43:14.1739587Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2020-12-15T00:43:14.1739587Z", - } - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - virtualNetworkRules: [] - primaryEndpoints: - { - blob: "https://sto4445.blob.core.windows.net/", - dfs: "https://sto4445.dfs.core.windows.net/", - file: "https://sto4445.file.core.windows.net/", - queue: "https://sto4445.queue.core.windows.net/", - table: "https://sto4445.table.core.windows.net/", - web: "https://sto4445.web.core.windows.net/", - } - primaryLocation: eastus - privateEndpointConnections: [] - provisioningState: Succeeded - statusOfPrimary: available - supportsHttpsTrafficOnly: true - sku: { name: Standard_LRS, tier: Standard } - tags: {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "The update operation can be used to update the SKU, - encryption, access tier, or tags for a storage account. It can also be used - to map the account to a custom domain. Only one custom domain is supported - per storage account; the replacement/change of custom domain is not supported. - In order to replace an old custom domain, the old value must be cleared/unregistered - before a new value can be set. The update of multiple properties is supported. - This call does not change the storage keys for the account. If you want - to change the storage account keys, use the regenerate keys operation. The - location and name of the storage account cannot be changed after creation.", name: Update } - java: { description: "The update operation can be used to update the SKU, encryption, - access tier, or tags for a storage account. It can also be used to map the - account to a custom domain. Only one custom domain is supported per storage - account; the replacement/change of custom domain is not supported. In order - to replace an old custom domain, the old value must be cleared/unregistered - before a new value can be set. The update of multiple properties is supported. - This call does not change the storage keys for the account. If you want - to change the storage account keys, use the regenerate keys operation. The - location and name of the storage account cannot be changed after creation.", name: update } - operationGroup: *id120 - operationId: StorageAccounts_Update - parameters: - - *id030 - - &id151 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id150 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id152 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id150 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id151 - - *id152 - - *id035 - - *id031 - - &id154 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for the updated account., - name: parameters, - } - java: - { - description: The parameters to provide for the updated account., - name: parameters, - } - nullable: false - operation: *id150 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id527 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The parameters that can be provided when updating - the storage account properties., name: StorageAccountUpdateParameters, namespace: "" } - java: { description: The parameters that can be provided when updating - the storage account properties., name: StorageAccountUpdateParameters } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Gets or sets the SKU name. Note that the SKU - name cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, - nor can accounts of those SKU names be updated to any other value.", name: sku } - java: { description: "Gets or sets the SKU name. Note that the SKU name - cannot be updated to Standard_ZRS, Premium_LRS or Premium_ZRS, nor - can accounts of those SKU names be updated to any other value.", name: sku } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id126 - serializedName: sku - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets or sets a list of key value pairs that describe - the resource. These tags can be used in viewing and grouping this - resource (across resource groups). A maximum of 15 tags can be provided - for a resource. Each tag must have a key no greater in length than - 128 characters and a value no greater in length than 256 characters., name: tags } - java: { description: Gets or sets a list of key value pairs that describe - the resource. These tags can be used in viewing and grouping this - resource (across resource groups). A maximum of 15 tags can be provided - for a resource. Each tag must have a key no greater in length than - 128 characters and a value no greater in length than 256 characters., name: tags } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DictionarySchema &id479 - apiVersions: [] - elementType: *id032 - language: - default: { description: Gets or sets a list of key value pairs that - describe the resource. These tags can be used in viewing and grouping - this resource (across resource groups). A maximum of 15 tags can - be provided for a resource. Each tag must have a key no greater - in length than 128 characters and a value no greater in length - than 256 characters., name: StorageAccountUpdateParametersTags } - java: { description: Gets or sets a list of key value pairs that describe - the resource. These tags can be used in viewing and grouping this - resource (across resource groups). A maximum of 15 tags can be - provided for a resource. Each tag must have a key no greater in - length than 128 characters and a value no greater in length than - 256 characters., name: StorageAccountUpdateParametersTags } - protocol: {} - type: DICTIONARY - serializedName: tags - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The identity of the resource., name: identity } - java: { description: The identity of the resource., name: identity } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id128 - serializedName: identity - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: The parameters used when updating a storage account., - name: properties, - } - java: - { - description: The parameters used when updating a storage account., - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id528 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: { description: The parameters used when updating a storage - account., name: StorageAccountPropertiesUpdateParameters, namespace: "" } - java: - { - description: The parameters used when updating a storage account., - name: StorageAccountPropertiesUpdateParameters, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Custom domain assigned to the storage account - by the user. Name is the CNAME source. Only one custom domain - is supported per storage account at this time. To clear the - existing custom domain, use an empty string for the custom domain - name property.", name: customDomain } - java: { description: "Custom domain assigned to the storage account - by the user. Name is the CNAME source. Only one custom domain - is supported per storage account at this time. To clear the - existing custom domain, use an empty string for the custom domain - name property.", name: customDomain } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id129 - serializedName: customDomain - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Provides the encryption settings on the account. - The default setting is unencrypted., name: encryption } - java: { description: Provides the encryption settings on the account. - The default setting is unencrypted., name: encryption } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id130 - serializedName: encryption - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required for storage accounts where kind - = BlobStorage. The access tier used for billing., name: accessTier } - java: - { - description: - Required for storage accounts where kind = BlobStorage. - The access tier used for billing., - name: accessTier, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id132 - serializedName: accessTier - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Provides the identity based authentication - settings for Azure Files., name: azureFilesIdentityBasedAuthentication } - java: - { description: Provides the identity based authentication settings - for Azure Files., name: azureFilesIdentityBasedAuthentication } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id133 - serializedName: azureFilesIdentityBasedAuthentication - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Allows https traffic only to storage service - if sets to true., name: enableHttpsTrafficOnly } - java: { description: Allows https traffic only to storage service - if sets to true., name: enableHttpsTrafficOnly } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id153 - serializedName: supportsHttpsTrafficOnly - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Network rule set, name: networkRuleSet } - java: { description: Network rule set, name: networkRuleSet } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id131 - serializedName: networkAcls - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Allow large file shares if sets to Enabled. - It cannot be disabled once it is enabled., name: largeFileSharesState } - java: { description: Allow large file shares if sets to Enabled. - It cannot be disabled once it is enabled., name: largeFileSharesState } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id135 - serializedName: largeFileSharesState - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Maintains information about the network routing - choice opted by the user for data transfer, name: routingPreference } - java: { description: Maintains information about the network routing - choice opted by the user for data transfer, name: routingPreference } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id136 - serializedName: routingPreference - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Allow or disallow public access to all blobs - or containers in the storage account. The default interpretation - is true for this property., name: allowBlobPublicAccess } - java: { description: Allow or disallow public access to all blobs - or containers in the storage account. The default interpretation - is true for this property., name: allowBlobPublicAccess } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id137 - serializedName: allowBlobPublicAccess - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Set the minimum TLS version to be permitted - on requests to storage. The default interpretation is TLS 1.0 - for this property., name: minimumTlsVersion } - java: { description: Set the minimum TLS version to be permitted - on requests to storage. The default interpretation is TLS 1.0 - for this property., name: minimumTlsVersion } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id138 - serializedName: minimumTlsVersion - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "Indicates whether the storage account permits - requests to be authorized with the account access key via Shared - Key. If false, then all requests, including shared access signatures, - must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true.", name: allowSharedKeyAccess } - java: { description: "Indicates whether the storage account permits - requests to be authorized with the account access key via Shared - Key. If false, then all requests, including shared access signatures, - must be authorized with Azure Active Directory (Azure AD). The - default value is null, which is equivalent to true.", name: allowSharedKeyAccess } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id139 - serializedName: allowSharedKeyAccess - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Optional. Indicates the type of storage account. - Currently only StorageV2 value supported by server., name: kind } - java: { description: Optional. Indicates the type of storage account. - Currently only StorageV2 value supported by server., name: kind } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id119 - serializedName: kind - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id150 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: patch - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName} - uri: "{$host}" - signatureParameters: - - *id151 - - *id152 - - *id154 - responses: - - language: - default: - { description: OK -- storage account properties updated successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id142 - signatureParameters: - - *id151 - - *id152 - - &id160 - apiVersions: &id155 - - { version: "2021-01-01" } - exceptions: &id156 [] - extensions: &id157 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountList: - parameters: - { - api-version: 2020-08-01-preview, - monitor: "true", - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountList.json - responses: - "200": - body: - value: - - name: sto1125 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res2627/providers/Microsoft.Storage/storageAccounts/sto1125 - kind: Storage - location: eastus - properties: - creationTime: "2017-05-24T13:28:53.4540398Z" - encryption: - keySource: Microsoft.Storage - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - isHnsEnabled: true - primaryEndpoints: - blob: https://sto1125.blob.core.windows.net/ - dfs: https://sto1125.dfs.core.windows.net/ - file: https://sto1125.file.core.windows.net/ - internetEndpoints: - { - blob: "https://sto1125-internetrouting.blob.core.windows.net/", - dfs: "https://sto1125-internetrouting.dfs.core.windows.net/", - file: "https://sto1125-internetrouting.file.core.windows.net/", - web: "https://sto1125-internetrouting.web.core.windows.net/", - } - microsoftEndpoints: - { - blob: "https://sto1125-microsoftrouting.blob.core.windows.net/", - dfs: "https://sto1125-microsoftrouting.dfs.core.windows.net/", - file: "https://sto1125-microsoftrouting.file.core.windows.net/", - queue: "https://sto1125-microsoftrouting.queue.core.windows.net/", - table: "https://sto1125-microsoftrouting.table.core.windows.net/", - web: "https://sto1125-microsoftrouting.web.core.windows.net/", - } - queue: https://sto1125.queue.core.windows.net/ - table: https://sto1125.table.core.windows.net/ - web: https://sto1125.web.core.windows.net/ - primaryLocation: eastus - provisioningState: Succeeded - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - - name: sto3699 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/testcmk3/providers/Microsoft.Storage/storageAccounts/sto3699 - identity: - { - type: SystemAssigned, - principalId: 356d057d-cba5-44dd-8a30-b2e547bc416b, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - kind: Storage - location: eastus - properties: - creationTime: "2017-05-24T10:06:30.6093014Z" - primaryEndpoints: - { - blob: "https://sto3699.blob.core.windows.net/", - file: "https://sto3699.file.core.windows.net/", - queue: "https://sto3699.queue.core.windows.net/", - table: "https://sto3699.table.core.windows.net/", - } - primaryLocation: eastus - provisioningState: Succeeded - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - - name: sto8596 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res9407/providers/Microsoft.Storage/storageAccounts/sto8596 - identity: - { - type: SystemAssigned, - principalId: 911871cc-ffd1-4fc4-ac11-7a316433ea66, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - kind: Storage - location: eastus2(stage) - properties: - creationTime: "2017-06-01T02:42:41.7633306Z" - encryption: - keySource: Microsoft.Keyvault - keyvaultproperties: - { - currentVersionedKeyIdentifier: "https://myvault8569.vault.azure.net/keys/wrappingKey/0682afdd9c104f4285df20107e956cad", - keyname: wrappingKey, - keyvaulturi: "https://myvault8569.vault.azure.net", - keyversion: "", - lastKeyRotationTimestamp: "2019-12-13T20:36:23.7023290Z", - } - services: - blob: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - file: - { - enabled: true, - keyType: Account, - lastEnabledTime: "2019-12-11T20:49:31.7036140Z", - } - geoReplicationStats: - { - canFailover: true, - lastSyncTime: "2018-10-30T00:25:34Z", - status: Live, - } - isHnsEnabled: true - networkAcls: - bypass: AzureServices - defaultAction: Allow - ipRules: [] - resourceAccessRules: - - { - resourceId: /subscriptions/a7e99807-abbf-4642-bdec-2c809a96a8bc/resourceGroups/res9407/providers/Microsoft.Synapse/workspaces/testworkspace, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - virtualNetworkRules: [] - primaryEndpoints: - blob: https://sto8596.blob.core.windows.net/ - dfs: https://sto8596.dfs.core.windows.net/ - file: https://sto8596.file.core.windows.net/ - internetEndpoints: - { - blob: "https://sto8596-internetrouting.blob.core.windows.net/", - dfs: "https://sto8596-internetrouting.dfs.core.windows.net/", - file: "https://sto8596-internetrouting.file.core.windows.net/", - web: "https://sto8596-internetrouting.web.core.windows.net/", - } - microsoftEndpoints: - { - blob: "https://sto8596-microsoftrouting.blob.core.windows.net/", - dfs: "https://sto8596-microsoftrouting.dfs.core.windows.net/", - file: "https://sto8596-microsoftrouting.file.core.windows.net/", - queue: "https://sto8596-microsoftrouting.queue.core.windows.net/", - table: "https://sto8596-microsoftrouting.table.core.windows.net/", - web: "https://sto8596-microsoftrouting.web.core.windows.net/", - } - queue: https://sto8596.queue.core.windows.net/ - table: https://sto8596.table.core.windows.net/ - web: https://sto8596.web.core.windows.net/ - primaryLocation: eastus2(stage) - provisioningState: Succeeded - routingPreference: - { - publishInternetEndpoints: true, - publishMicrosoftEndpoints: true, - routingChoice: MicrosoftRouting, - } - secondaryLocation: northcentralus(stage) - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - - name: sto6637 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/testcmk3/providers/Microsoft.Storage/storageAccounts/sto6637 - identity: - { - type: SystemAssigned, - principalId: 911871cc-ffd1-4fc4-ac11-7a316433ea66, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - kind: Storage - location: eastus - properties: - creationTime: "2017-05-24T10:09:39.5625175Z" - primaryEndpoints: - { - blob: "https://sto6637.blob.core.windows.net/", - file: "https://sto6637.file.core.windows.net/", - queue: "https://sto6637.queue.core.windows.net/", - table: "https://sto6637.table.core.windows.net/", - } - primaryLocation: eastus - provisioningState: Succeeded - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - - name: sto834 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res8186/providers/Microsoft.Storage/storageAccounts/sto834 - kind: Storage - location: eastus - properties: - creationTime: "2017-05-24T13:28:20.8686541Z" - primaryEndpoints: - { - blob: "https://sto834.blob.core.windows.net/", - file: "https://sto834.file.core.windows.net/", - queue: "https://sto834.queue.core.windows.net/", - table: "https://sto834.table.core.windows.net/", - } - primaryLocation: eastus - provisioningState: Succeeded - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - - name: sto9174 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/testcmk3/providers/Microsoft.Storage/storageAccounts/sto9174 - identity: - { - type: SystemAssigned, - principalId: 933e3ddf-1802-4a51-9469-18a33b576f88, - tenantId: 72f988bf-86f1-41af-91ab-2d7cd011db47, - } - kind: Storage - location: eastus - properties: - creationTime: "2017-05-24T09:46:19.6556989Z" - primaryEndpoints: - { - blob: "https://sto9174.blob.core.windows.net/", - file: "https://sto9174.file.core.windows.net/", - queue: "https://sto9174.queue.core.windows.net/", - table: "https://sto9174.table.core.windows.net/", - } - primaryLocation: eastus - provisioningState: Succeeded - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id159 - $key: listNext - apiVersions: *id155 - exceptions: *id156 - extensions: *id157 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id120 - parameters: [] - requests: - - language: &id162 - default: { description: Lists all the storage accounts available under - the subscription. Note that storage keys are not returned; use the - ListKeys operation for this., name: List } - java: { description: Lists all the storage accounts available under the - subscription. Note that storage keys are not returned; use the ListKeys - operation for this., name: list } - parameters: - - &id161 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id158 { name: nextLink, serializedName: nextLink } - java: *id158 - nullable: false - operation: *id159 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id030 - - &id163 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id160 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id161 - responses: &id164 - - language: - default: { description: OK -- List of storage accounts was retrieved - and returned successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id172 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The response from the List Storage Accounts - operation., name: StorageAccountListResult, namespace: "" } - java: - { - description: The response from the List Storage Accounts operation., - name: StorageAccountListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the list of storage accounts and their - properties., name: value } - java: { description: Gets the list of storage accounts and their - properties., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id363 - apiVersions: - - { version: "2021-01-01" } - elementType: *id142 - language: - default: { description: Gets the list of storage accounts and their - properties., name: StorageAccountListResultValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Request URL that can be used to query next - page of storage accounts. Returned when total number of requested - storage accounts exceed maximum page size., name: nextLink } - java: { description: Request URL that can be used to query next page - of storage accounts. Returned when total number of requested - storage accounts exceed maximum page size., name: nextLink } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id672 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Request URL that can be used to query next - page of storage accounts. Returned when total number of requested - storage accounts exceed maximum page size., name: StorageAccountListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id162 - operationGroup: *id120 - operationId: StorageAccounts_List - parameters: - - *id030 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id035 - - *id031 - - *id163 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts", - uri: "{$host}", - } - signatureParameters: [] - responses: *id164 - signatureParameters: [] - - &id170 - apiVersions: &id165 - - { version: "2021-01-01" } - exceptions: &id166 [] - extensions: &id167 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountListByResourceGroup: - parameters: - { - api-version: 2020-08-01-preview, - resourceGroupName: res6117, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListByResourceGroup.json - responses: - "200": - body: - value: - - name: sto4036 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res6117/providers/Microsoft.Storage/storageAccounts/sto4036 - kind: Storage - location: eastus - properties: - creationTime: "2017-05-24T13:24:47.818801Z" - isHnsEnabled: true - primaryEndpoints: - { - blob: "https://sto4036.blob.core.windows.net/", - dfs: "https://sto4036.dfs.core.windows.net/", - file: "https://sto4036.file.core.windows.net/", - queue: "https://sto4036.queue.core.windows.net/", - table: "https://sto4036.table.core.windows.net/", - web: "https://sto4036.web.core.windows.net/", - } - primaryLocation: eastus - provisioningState: Succeeded - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - - name: sto4452 - type: Microsoft.Storage/storageAccounts - id: /subscriptions/{subscription-id}/resourceGroups/res6117/providers/Microsoft.Storage/storageAccounts/sto4452 - kind: Storage - location: eastus - properties: - creationTime: "2017-05-24T13:24:15.7068366Z" - primaryEndpoints: - { - blob: "https://sto4452.blob.core.windows.net/", - file: "https://sto4452.file.core.windows.net/", - queue: "https://sto4452.queue.core.windows.net/", - table: "https://sto4452.table.core.windows.net/", - } - primaryLocation: eastus - provisioningState: Succeeded - secondaryLocation: centraluseuap - statusOfPrimary: available - statusOfSecondary: available - supportsHttpsTrafficOnly: false - sku: { name: Standard_GRS, tier: Standard } - tags: { key1: value1, key2: value2 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id169 - $key: listByResourceGroupNext - apiVersions: *id165 - exceptions: *id166 - extensions: *id167 - language: - java: { description: Get the next page of items, name: listByResourceGroupNext } - operationGroup: *id120 - parameters: [] - requests: - - language: &id173 - default: { description: Lists all the storage accounts available under - the given resource group. Note that storage keys are not returned; - use the ListKeys operation for this., name: ListByResourceGroup } - java: { description: Lists all the storage accounts available under the - given resource group. Note that storage keys are not returned; use - the ListKeys operation for this., name: listByResourceGroup } - parameters: - - &id171 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id168 { name: nextLink, serializedName: nextLink } - java: *id168 - nullable: false - operation: *id169 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id030 - - &id175 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id170 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id171 - responses: &id176 - - language: - default: { description: OK -- List of storage accounts in the given resource - group retrieved and returned successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id172 - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id173 - operationGroup: *id120 - operationId: StorageAccounts_ListByResourceGroup - parameters: - - *id030 - - &id174 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id170 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id174 - - *id035 - - *id031 - - *id175 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts", - uri: "{$host}", - } - signatureParameters: - - *id174 - responses: *id176 - signatureParameters: - - *id174 - - &id177 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountListKeys: - parameters: - { - accountName: sto2220, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res418, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListKeys.json - responses: - "200": - body: - keys: - - { keyName: key1, permissions: Full, value: } - - { keyName: key2, permissions: Full, value: } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Lists the access keys or Kerberos keys (if active directory - enabled) for the specified storage account., name: ListKeys } - java: { description: Lists the access keys or Kerberos keys (if active directory - enabled) for the specified storage account., name: listKeys } - operationGroup: *id120 - operationId: StorageAccounts_ListKeys - parameters: - - *id030 - - &id178 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id177 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id179 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id177 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id180 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Specifies type of the key to be listed. Possible value - is kerb., name: expand, serializedName: $expand } - java: { description: Specifies type of the key to be listed. Possible value - is kerb., name: expand, serializedName: $expand } - nullable: false - operation: *id177 - protocol: - http: { explode: false, in: QUERY } - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id589 - apiVersions: [] - choiceType: *id010 - choices: - - { value: kerb } - language: &id452 - default: { description: "", name: ListKeyExpand } - java: { description: "", name: ListKeyExpand } - type: SEALED_CHOICE - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id178 - - *id179 - - *id035 - - *id031 - - *id180 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id177 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys", - uri: "{$host}", - } - signatureParameters: - - *id178 - - *id179 - - *id180 - responses: - - language: - default: - { description: OK -- list of keys retrieved and returned successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id185 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The response from the ListKeys operation., - name: StorageAccountListKeysResult, - namespace: "", - } - java: - { - description: The response from the ListKeys operation., - name: StorageAccountListKeysResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the list of storage account keys and their - properties for the specified storage account., name: keys } - java: { description: Gets the list of storage account keys and their properties - for the specified storage account., name: keys } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id364 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id531 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: An access key for the storage account., - name: StorageAccountKey, - namespace: "", - } - java: - { - description: An access key for the storage account., - name: StorageAccountKey, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Name of the key., name: keyName } - java: { description: Name of the key., name: keyName } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id673 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: Name of the key., name: StorageAccountKeyName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyName - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Base 64-encoded value of the key., name: value } - java: { description: Base 64-encoded value of the key., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id674 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Base 64-encoded value of the key., - name: StorageAccountKeyValue, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Permissions for the key -- read-only or full - permissions., name: permissions } - java: { description: Permissions for the key -- read-only or full - permissions., name: permissions } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id586 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: READ } - value: Read - - language: - default: { description: "", name: FULL } - value: Full - language: - default: { description: Permissions for the key -- read-only or - full permissions., name: KeyPermission } - java: { description: Permissions for the key -- read-only or full - permissions., name: KeyPermission } - protocol: {} - type: SEALED_CHOICE - serializedName: permissions - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: { description: Gets the list of storage account keys and their - properties for the specified storage account., name: StorageAccountListKeysResultKeys } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: keys - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id178 - - *id179 - - *id180 - - &id181 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountRegenerateKey: - parameters: - accountName: sto3539 - api-version: 2020-08-01-preview - monitor: "true" - regenerateKey: { keyName: key2 } - resourceGroupName: res4167 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountRegenerateKey.json - responses: - "200": - body: - keys: - - { keyName: key1, permissions: Full, value: } - - { keyName: key2, permissions: Full, value: } - StorageAccountRegenerateKerbKey: - parameters: - accountName: sto3539 - api-version: 2020-08-01-preview - monitor: "true" - regenerateKey: { keyName: kerb1 } - resourceGroupName: res4167 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountRegenerateKerbKey.json - responses: - "200": - body: - keys: - - { keyName: key1, permissions: Full, value: } - - { keyName: key2, permissions: Full, value: } - - { keyName: kerb1, permissions: Full, value: } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Regenerates one of the access keys or Kerberos keys for - the specified storage account., name: RegenerateKey } - java: { description: Regenerates one of the access keys or Kerberos keys for - the specified storage account., name: regenerateKey } - operationGroup: *id120 - operationId: StorageAccounts_RegenerateKey - parameters: - - *id030 - - &id182 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id181 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id183 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id181 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id182 - - *id183 - - *id035 - - *id031 - - &id184 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "Specifies name of the key which should be regenerated - -- key1, key2, kerb1, kerb2.", name: regenerateKey } - java: { description: "Specifies name of the key which should be regenerated - -- key1, key2, kerb1, kerb2.", name: regenerateKey } - nullable: false - operation: *id181 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id532 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The parameters used to regenerate the storage account - key., name: StorageAccountRegenerateKeyParameters, namespace: "" } - java: { description: The parameters used to regenerate the storage account - key., name: StorageAccountRegenerateKeyParameters } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "The name of storage keys that want to be regenerated, - possible values are key1, key2, kerb1, kerb2.", name: keyName } - java: { description: "The name of storage keys that want to be regenerated, - possible values are key1, key2, kerb1, kerb2.", name: keyName } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id675 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: "The name of storage keys that want to be regenerated, - possible values are key1, key2, kerb1, kerb2.", name: StorageAccountRegenerateKeyParametersKeyName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyName - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id181 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey - uri: "{$host}" - signatureParameters: - - *id182 - - *id183 - - *id184 - responses: - - language: - default: { description: OK -- specified key regenerated successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id185 - signatureParameters: - - *id182 - - *id183 - - &id186 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountListAccountSAS: - parameters: - accountName: sto8588 - api-version: 2020-08-01-preview - monitor: "true" - parameters: - { - keyToSign: key1, - signedExpiry: "2017-05-24T11:42:03.1567373Z", - signedPermission: r, - signedProtocol: "https,http", - signedResourceTypes: s, - signedServices: b, - signedStart: "2017-05-24T10:42:03.1567373Z", - } - resourceGroupName: res7985 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListAccountSAS.json - responses: - "200": - body: - { - accountSasToken: "sv=2015-04-05&ss=b&srt=s&sp=r&st=2017-05-24T10%3A42%3A03Z&se=2017-05-24T11%3A42%3A03Z&spr=https,http&sig=Z0I%2BEpM%2BPPlTC8ApfUf%2BcffO2aahMgZim3U0iArqsS0%3D", - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: List SAS credentials of a storage account., name: ListAccountSas } - java: { description: List SAS credentials of a storage account., name: listAccountSas } - operationGroup: *id120 - operationId: StorageAccounts_ListAccountSAS - parameters: - - *id030 - - &id187 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id186 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id188 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id186 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id187 - - *id188 - - *id035 - - *id031 - - &id189 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The parameters to provide to list SAS credentials - for the storage account., name: parameters } - java: { description: The parameters to provide to list SAS credentials for - the storage account., name: parameters } - nullable: false - operation: *id186 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id536 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The parameters to list SAS credentials of a storage - account., name: AccountSasParameters, namespace: "" } - java: { description: The parameters to list SAS credentials of a storage - account., name: AccountSasParameters } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The signed services accessible with the account - SAS. Possible values include: Blob (b), Queue (q), Table (t), File - (f).", name: services } - java: { description: "The signed services accessible with the account - SAS. Possible values include: Blob (b), Queue (q), Table (t), File - (f).", name: services } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id433 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: B } - value: b - - language: - default: { description: "", name: Q } - value: q - - language: - default: { description: "", name: T } - value: t - - language: - default: { description: "", name: F } - value: f - language: - default: { description: "The signed services accessible with the account - SAS. Possible values include: Blob (b), Queue (q), Table (t), - File (f).", name: Services } - java: { description: "The signed services accessible with the account - SAS. Possible values include: Blob (b), Queue (q), Table (t), - File (f).", name: Services } - protocol: {} - type: CHOICE - serializedName: signedServices - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The signed resource types that are accessible - with the account SAS. Service (s): Access to service-level APIs; - Container (c): Access to container-level APIs; Object (o): Access - to object-level APIs for blobs, queue messages, table entities, - and files.", name: resourceTypes } - java: { description: "The signed resource types that are accessible with - the account SAS. Service (s): Access to service-level APIs; Container - (c): Access to container-level APIs; Object (o): Access to object-level - APIs for blobs, queue messages, table entities, and files.", name: resourceTypes } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id434 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: S } - value: s - - language: - default: { description: "", name: C } - value: c - - language: - default: { description: "", name: O } - value: o - language: - default: { description: "The signed resource types that are accessible - with the account SAS. Service (s): Access to service-level APIs; - Container (c): Access to container-level APIs; Object (o): Access - to object-level APIs for blobs, queue messages, table entities, - and files.", name: SignedResourceTypes } - java: { description: "The signed resource types that are accessible - with the account SAS. Service (s): Access to service-level APIs; - Container (c): Access to container-level APIs; Object (o): Access - to object-level APIs for blobs, queue messages, table entities, - and files.", name: SignedResourceTypes } - protocol: {} - type: CHOICE - serializedName: signedResourceTypes - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The signed permissions for the account SAS. - Possible values include: Read (r), Write (w), Delete (d), List (l), - Add (a), Create (c), Update (u) and Process (p).", name: permissions } - java: { description: "The signed permissions for the account SAS. Possible - values include: Read (r), Write (w), Delete (d), List (l), Add (a), - Create (c), Update (u) and Process (p).", name: permissions } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id193 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: R } - value: r - - language: - default: { description: "", name: D } - value: d - - language: - default: { description: "", name: W } - value: w - - language: - default: { description: "", name: L } - value: l - - language: - default: { description: "", name: A } - value: a - - language: - default: { description: "", name: C } - value: c - - language: - default: { description: "", name: U } - value: u - - language: - default: { description: "", name: P } - value: p - language: - default: { description: "The signed permissions for the account SAS. - Possible values include: Read (r), Write (w), Delete (d), List - (l), Add (a), Create (c), Update (u) and Process (p).", name: Permissions } - java: { description: "The signed permissions for the account SAS. Possible - values include: Read (r), Write (w), Delete (d), List (l), Add - (a), Create (c), Update (u) and Process (p).", name: Permissions } - protocol: {} - type: CHOICE - serializedName: signedPermission - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An IP address or a range of IP addresses from - which to accept requests., name: IpAddressOrRange } - java: { description: An IP address or a range of IP addresses from which - to accept requests., name: ipAddressOrRange } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id678 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: An IP address or a range of IP addresses from - which to accept requests., name: AccountSasParametersSignedIp } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: signedIp - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The protocol permitted for a request made with - the account SAS., name: protocols } - java: { description: The protocol permitted for a request made with the - account SAS., name: protocols } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id194 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: HTTPS_HTTP } - value: https,http - - language: - default: { description: "", name: HTTPS } - value: https - language: - default: { description: The protocol permitted for a request made with - the account SAS., name: HttpProtocol } - java: { description: The protocol permitted for a request made with - the account SAS., name: HttpProtocol } - protocol: {} - type: SEALED_CHOICE - serializedName: signedProtocol - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The time at which the SAS becomes valid., - name: sharedAccessStartTime, - } - java: - { - description: The time at which the SAS becomes valid., - name: sharedAccessStartTime, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id459 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { - description: The time at which the SAS becomes valid., - name: AccountSasParametersSignedStart, - } - protocol: {} - type: DATE_TIME - serializedName: signedStart - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The time at which the shared access signature - becomes invalid., name: sharedAccessExpiryTime } - java: { description: The time at which the shared access signature becomes - invalid., name: sharedAccessExpiryTime } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id460 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: The time at which the shared access signature - becomes invalid., name: AccountSasParametersSignedExpiry } - protocol: {} - type: DATE_TIME - serializedName: signedExpiry - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The key to sign the account SAS token with., - name: keyToSign, - } - java: - { - description: The key to sign the account SAS token with., - name: keyToSign, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id679 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The key to sign the account SAS token with., - name: AccountSasParametersKeyToSign, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyToSign - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id186 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas - uri: "{$host}" - signatureParameters: - - *id187 - - *id188 - - *id189 - responses: - - language: - default: { description: OK -- returned the account SAS created for the storage - account requested., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id537 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The List SAS credentials operation response., - name: ListAccountSasResponse, - namespace: "", - } - java: - { - description: The List SAS credentials operation response., - name: ListAccountSasResponse, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: List SAS credentials of storage account., - name: accountSasToken, - } - java: - { - description: List SAS credentials of storage account., - name: accountSasToken, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id680 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: List SAS credentials of storage account., - name: ListAccountSasResponseAccountSasToken, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: accountSasToken - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id187 - - *id188 - - &id190 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountListServiceSAS: - parameters: - accountName: sto1299 - api-version: 2020-08-01-preview - monitor: "true" - parameters: - { - canonicalizedResource: /blob/sto1299/music, - signedExpiry: "2017-05-24T11:32:48.8457197Z", - signedPermission: l, - signedResource: c, - } - resourceGroupName: res7439 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListServiceSAS.json - responses: - "200": - body: - { - serviceSasToken: sv=2015-04-05&sr=c&se=2017-05-24T11%3A32%3A48Z&sp=l&sig=PoF8yBUGixsjzwroLmw7vG3VbGz4KB2woZC2D4C2oio%3D, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { - description: List service SAS credentials of a specific resource., - name: ListServiceSas, - } - java: - { - description: List service SAS credentials of a specific resource., - name: listServiceSas, - } - operationGroup: *id120 - operationId: StorageAccounts_ListServiceSAS - parameters: - - *id030 - - &id191 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id190 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id192 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id190 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id191 - - *id192 - - *id035 - - *id031 - - &id195 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide to list service SAS credentials., - name: parameters, - } - java: - { - description: The parameters to provide to list service SAS credentials., - name: parameters, - } - nullable: false - operation: *id190 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id538 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The parameters to list service SAS credentials - of a specific resource., name: ServiceSasParameters, namespace: "" } - java: { description: The parameters to list service SAS credentials of - a specific resource., name: ServiceSasParameters } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The canonical path to the signed resource., - name: canonicalizedResource, - } - java: - { - description: The canonical path to the signed resource., - name: canonicalizedResource, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id681 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The canonical path to the signed resource., - name: ServiceSasParametersCanonicalizedResource, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: canonicalizedResource - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The signed services accessible with the service - SAS. Possible values include: Blob (b), Container (c), File (f), - Share (s).", name: resource } - java: { description: "The signed services accessible with the service - SAS. Possible values include: Blob (b), Container (c), File (f), - Share (s).", name: resource } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id435 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: B } - value: b - - language: - default: { description: "", name: C } - value: c - - language: - default: { description: "", name: F } - value: f - - language: - default: { description: "", name: S } - value: s - language: - default: { description: "The signed services accessible with the service - SAS. Possible values include: Blob (b), Container (c), File (f), - Share (s).", name: SignedResource } - java: { description: "The signed services accessible with the service - SAS. Possible values include: Blob (b), Container (c), File (f), - Share (s).", name: SignedResource } - protocol: {} - type: CHOICE - serializedName: signedResource - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The signed permissions for the service SAS. - Possible values include: Read (r), Write (w), Delete (d), List (l), - Add (a), Create (c), Update (u) and Process (p).", name: permissions } - java: { description: "The signed permissions for the service SAS. Possible - values include: Read (r), Write (w), Delete (d), List (l), Add (a), - Create (c), Update (u) and Process (p).", name: permissions } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id193 - serializedName: signedPermission - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An IP address or a range of IP addresses from - which to accept requests., name: IpAddressOrRange } - java: { description: An IP address or a range of IP addresses from which - to accept requests., name: ipAddressOrRange } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id682 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: An IP address or a range of IP addresses from - which to accept requests., name: ServiceSasParametersSignedIp } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: signedIp - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The protocol permitted for a request made with - the account SAS., name: protocols } - java: { description: The protocol permitted for a request made with the - account SAS., name: protocols } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id194 - serializedName: signedProtocol - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The time at which the SAS becomes valid., - name: sharedAccessStartTime, - } - java: - { - description: The time at which the SAS becomes valid., - name: sharedAccessStartTime, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id461 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { - description: The time at which the SAS becomes valid., - name: ServiceSasParametersSignedStart, - } - protocol: {} - type: DATE_TIME - serializedName: signedStart - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The time at which the shared access signature - becomes invalid., name: sharedAccessExpiryTime } - java: { description: The time at which the shared access signature becomes - invalid., name: sharedAccessExpiryTime } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id462 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: The time at which the shared access signature - becomes invalid., name: ServiceSasParametersSignedExpiry } - protocol: {} - type: DATE_TIME - serializedName: signedExpiry - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "A unique value up to 64 characters in length - that correlates to an access policy specified for the container, - queue, or table.", name: identifier } - java: { description: "A unique value up to 64 characters in length that - correlates to an access policy specified for the container, queue, - or table.", name: identifier } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id683 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "A unique value up to 64 characters in length - that correlates to an access policy specified for the container, - queue, or table.", name: ServiceSasParametersSignedIdentifier } - maxLength: 64.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: signedIdentifier - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The start of partition key., name: partitionKeyStart } - java: { description: The start of partition key., name: partitionKeyStart } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id684 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The start of partition key., - name: ServiceSasParametersStartPk, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: startPk - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The end of partition key., name: partitionKeyEnd } - java: { description: The end of partition key., name: partitionKeyEnd } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id685 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The end of partition key., - name: ServiceSasParametersEndPk, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: endPk - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The start of row key., name: rowKeyStart } - java: { description: The start of row key., name: rowKeyStart } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id686 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The start of row key., - name: ServiceSasParametersStartRk, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: startRk - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The end of row key., name: rowKeyEnd } - java: { description: The end of row key., name: rowKeyEnd } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id687 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: The end of row key., name: ServiceSasParametersEndRk } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: endRk - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The key to sign the account SAS token with., - name: keyToSign, - } - java: - { - description: The key to sign the account SAS token with., - name: keyToSign, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id688 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The key to sign the account SAS token with., - name: ServiceSasParametersKeyToSign, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyToSign - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The response header override for cache control., - name: cacheControl, - } - java: - { - description: The response header override for cache control., - name: cacheControl, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id689 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The response header override for cache control., - name: ServiceSasParametersRscc, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: rscc - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The response header override for content disposition., - name: contentDisposition, - } - java: - { - description: The response header override for content disposition., - name: contentDisposition, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id690 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The response header override for content disposition., - name: ServiceSasParametersRscd, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: rscd - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The response header override for content encoding., - name: contentEncoding, - } - java: - { - description: The response header override for content encoding., - name: contentEncoding, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id691 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The response header override for content encoding., - name: ServiceSasParametersRsce, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: rsce - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The response header override for content language., - name: contentLanguage, - } - java: - { - description: The response header override for content language., - name: contentLanguage, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id692 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The response header override for content language., - name: ServiceSasParametersRscl, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: rscl - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The response header override for content type., - name: contentType, - } - java: - { - description: The response header override for content type., - name: contentType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id693 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The response header override for content type., - name: ServiceSasParametersRsct, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: rsct - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id190 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas - uri: "{$host}" - signatureParameters: - - *id191 - - *id192 - - *id195 - responses: - - language: - default: { description: OK -- returned the service SAS created for the storage - service requested., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id539 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The List service SAS credentials operation response., - name: ListServiceSasResponse, - namespace: "", - } - java: - { - description: The List service SAS credentials operation response., - name: ListServiceSasResponse, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: List service SAS credentials of specific resource., - name: serviceSasToken, - } - java: - { - description: List service SAS credentials of specific resource., - name: serviceSasToken, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id694 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: List service SAS credentials of specific resource., - name: ListServiceSasResponseServiceSasToken, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: serviceSasToken - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id191 - - *id192 - - &id196 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountFailover: - parameters: - { - accountName: sto2434, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res4228, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountFailover.json - responses: - "200": {} - "202": {} - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: location } - xmsSkipUrlEncoding: false - language: - default: { description: Failover request can be triggered for a storage account - in case of availability issues. The failover occurs from the storage account's - primary cluster to secondary cluster for RA-GRS accounts. The secondary - cluster will become primary after failover., name: Failover } - java: { description: Failover request can be triggered for a storage account - in case of availability issues. The failover occurs from the storage account's - primary cluster to secondary cluster for RA-GRS accounts. The secondary - cluster will become primary after failover., name: failover } - operationGroup: *id120 - operationId: StorageAccounts_Failover - parameters: - - *id030 - - &id197 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id198 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id196 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id197 - - *id198 - - *id035 - - *id031 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover", - uri: "{$host}", - } - signatureParameters: - - *id197 - - *id198 - responses: - - language: - default: { description: "OK -- Returned when the storage account failover is - completed, and the secondary cluster has become primary.", name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: Accepted -- Failover request accepted; operation will - complete asynchronously., name: "" } - protocol: - http: - explode: false - statusCodes: ["202"] - signatureParameters: - - *id197 - - *id198 - - &id199 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - BlobRangesRestore: - parameters: - accountName: sto4445 - api-version: 2020-08-01-preview - parameters: - blobRanges: - - { endRange: container/blobpath2, startRange: container/blobpath1 } - - { endRange: "", startRange: container2/blobpath3 } - timeToRestore: "2019-04-20T15:30:00.0000000Z" - resourceGroupName: res9101 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobRangesRestore.json - responses: - "200": - body: - parameters: - blobRanges: - - { endRange: container/blobpath2, startRange: container/blobpath1 } - - { endRange: "", startRange: container2/blobpath3 } - timeToRestore: "2019-04-20T15:30:00.0000000Z" - restoreId: "{restore_id}" - status: Complete - "202": - body: - parameters: - blobRanges: - - { endRange: container/blobpath2, startRange: container/blobpath1 } - - { endRange: "", startRange: container2/blobpath3 } - timeToRestore: "2019-04-20T15:30:00.0000000Z" - restoreId: "{restore_id}" - status: InProgress - xmsFlattened: false - xmsLongRunningOperation: true - xmsLongRunningOperationOptions: { finalStateVia: location } - xmsSkipUrlEncoding: false - language: - default: - { description: Restore blobs in the specified blob ranges, name: RestoreBlobRanges } - java: { description: Restore blobs in the specified blob ranges, name: restoreBlobRanges } - operationGroup: *id120 - operationId: StorageAccounts_RestoreBlobRanges - parameters: - - *id030 - - &id200 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id199 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id201 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id199 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id200 - - *id201 - - *id035 - - *id031 - - &id203 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The parameters to provide for restore blob ranges., - name: parameters, - } - java: - { - description: The parameters to provide for restore blob ranges., - name: parameters, - } - nullable: false - operation: *id199 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id202 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id199 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: post - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges - uri: "{$host}" - signatureParameters: - - *id200 - - *id201 - - *id203 - responses: - - language: - default: { description: OK -- returned when blob ranges are restored completely - with the same properties specified in the request body., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id204 - - language: - default: { description: Accepted -- Blob restore request accepted; operation - will complete asynchronously., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["202"] - schema: *id204 - signatureParameters: - - *id200 - - *id201 - - &id205 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountRevokeUserDelegationKeys: - parameters: - { - accountName: sto3539, - api-version: 2020-08-01-preview, - resourceGroupName: res4167, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountRevokeUserDelegationKeys.json - responses: - "200": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Revoke user delegation keys., name: RevokeUserDelegationKeys } - java: { description: Revoke user delegation keys., name: revokeUserDelegationKeys } - operationGroup: *id120 - operationId: StorageAccounts_RevokeUserDelegationKeys - parameters: - - *id030 - - &id206 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id205 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id207 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id205 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id206 - - *id207 - - *id035 - - *id031 - protocol: - http: - { - explode: false, - method: post, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys", - uri: "{$host}", - } - signatureParameters: - - *id206 - - *id207 - responses: - - language: - default: { description: OK -- revoke user delegation keys succeeded., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - signatureParameters: - - *id206 - - *id207 - - *id159 - - *id169 - protocol: {} - - &id211 - $key: DeletedAccounts - codeModel: *id001 - language: - default: { description: "", name: DeletedAccounts } - java: { description: "", name: DeletedAccounts } - operations: - - &id214 - apiVersions: &id208 - - { version: "2021-01-01" } - exceptions: &id209 - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id219 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: An error response from the storage resource provider., - name: ErrorResponse, - namespace: "", - } - java: - { - description: An error response from the storage resource provider., - name: ManagementError, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Azure Storage Resource Provider error response - body., name: error } - java: - { - description: Azure Storage Resource Provider error response body., - name: error, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Error response body contract., - name: ErrorResponseBody, - namespace: "", - } - java: { description: Error response body contract., name: ManagementError } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An identifier for the error. Codes are invariant - and are intended to be consumed programmatically., name: code } - java: { description: An identifier for the error. Codes are invariant - and are intended to be consumed programmatically., name: code } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id670 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: An identifier for the error. Codes are invariant - and are intended to be consumed programmatically., name: ErrorResponseBodyCode } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: code - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "A message describing the error, intended to - be suitable for display in a user interface.", name: message } - java: { description: "A message describing the error, intended to be - suitable for display in a user interface.", name: message } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id671 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "A message describing the error, intended - to be suitable for display in a user interface.", name: ErrorResponseBodyMessage } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: message - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - serializedName: error - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "EXCEPTION": null, - } - extensions: &id210 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - DeletedAccountList: - parameters: - { - api-version: 2020-08-01-preview, - monitor: "true", - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/DeletedAccountList.json - responses: - "200": - body: - value: - - name: sto1125 - type: Microsoft.Storage/deletedAccounts - id: /subscriptions/{subscription-id}/providers/Microsoft.Storage/locations/eastus/deletedAccounts/sto1125 - properties: - { - creationTime: "2020-08-17T03:35:37.4588848Z", - deletionTime: "2020-08-17T04:41:37.3442475Z", - location: eastus, - restoreReference: "sto1125|2020-08-17T03:35:37.4588848Z", - storageAccountResourceId: "/subscriptions/{subscription-id}/resourceGroups/sto/providers/Microsoft.Storage/storageAccounts/sto1125", - } - - name: sto1126 - type: Microsoft.Storage/deletedAccounts - id: /subscriptions/{subscription-id}/providers/Microsoft.Storage/locations/eastus/deletedAccounts/sto1126 - properties: - { - creationTime: "2020-08-19T15:10:21.5902165Z", - deletionTime: "2020-08-20T06:11:55.1957302Z", - location: eastus, - restoreReference: "sto1126|2020-08-17T03:35:37.4588848Z", - storageAccountResourceId: "/subscriptions/{subscription-id}/resourceGroups/sto/providers/Microsoft.Storage/storageAccounts/sto1126", - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id213 - $key: listNext - apiVersions: *id208 - exceptions: *id209 - extensions: *id210 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id211 - parameters: [] - requests: - - language: &id216 - default: - { description: Lists deleted accounts under the subscription., name: List } - java: - { description: Lists deleted accounts under the subscription., name: list } - parameters: - - &id215 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id212 { name: nextLink, serializedName: nextLink } - java: *id212 - nullable: false - operation: *id213 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id030 - - &id217 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id214 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id215 - responses: &id218 - - language: - default: { description: OK -- List of deleted accounts was retrieved - and returned successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id529 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The response from the List Deleted Accounts - operation., name: DeletedAccountListResult, namespace: "" } - java: - { - description: The response from the List Deleted Accounts operation., - name: DeletedAccountListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the list of deleted accounts and their - properties., name: value } - java: { description: Gets the list of deleted accounts and their - properties., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id362 - apiVersions: - - { version: "2021-01-01" } - elementType: *id021 - language: - default: { description: Gets the list of deleted accounts and their - properties., name: DeletedAccountListResultValue } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Request URL that can be used to query next - page of deleted accounts. Returned when total number of requested - deleted accounts exceed maximum page size., name: nextLink } - java: { description: Request URL that can be used to query next page - of deleted accounts. Returned when total number of requested - deleted accounts exceed maximum page size., name: nextLink } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id669 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Request URL that can be used to query next - page of deleted accounts. Returned when total number of requested - deleted accounts exceed maximum page size., name: DeletedAccountListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id216 - operationGroup: *id211 - operationId: DeletedAccounts_List - parameters: - - *id030 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id035 - - *id031 - - *id217 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/deletedAccounts", - uri: "{$host}", - } - signatureParameters: [] - responses: *id218 - signatureParameters: [] - - &id220 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - DeletedAccountGet: - parameters: - { - api-version: 2020-08-01-preview, - deletedAccountName: sto1125, - location: eastus, - monitor: "true", - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/DeletedAccountGet.json - responses: - "200": - body: - name: sto1125 - type: Microsoft.Storage/deletedAccounts - id: /subscriptions/{subscription-id}/providers/Microsoft.Storage/locations/eastus/deletedAccounts/sto1125 - properties: - { - creationTime: "2020-08-17T03:35:37.4588848Z", - deletionTime: "2020-08-17T04:41:37.3442475Z", - location: eastus, - restoreReference: "sto1125|2020-08-17T03:35:37.4588848Z", - storageAccountResourceId: "/subscriptions/{subscription-id}/resourceGroups/sto/providers/Microsoft.Storage/storageAccounts/sto1125", - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get properties of specified deleted account resource., name: Get } - java: { description: Get properties of specified deleted account resource., name: get } - operationGroup: *id211 - operationId: DeletedAccounts_Get - parameters: - - *id030 - - &id221 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Name of the deleted storage account., - name: deletedAccountName, - serializedName: deletedAccountName, - } - java: - { - description: Name of the deleted storage account., - name: deletedAccountName, - serializedName: deletedAccountName, - } - nullable: false - operation: *id220 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - &id222 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The location of the deleted storage account., - name: location, - serializedName: location, - } - java: - { - description: The location of the deleted storage account., - name: location, - serializedName: location, - } - nullable: false - operation: *id220 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id032 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id221 - - *id222 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id220 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/deletedAccounts/{deletedAccountName}", - uri: "{$host}", - } - signatureParameters: - - *id221 - - *id222 - responses: - - language: - default: { description: OK -- properties retrieved and returned successfully - for the deleted account., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id021 - signatureParameters: - - *id221 - - *id222 - - *id213 - protocol: {} - - &id223 - $key: Usages - codeModel: *id001 - language: - default: { description: "", name: Usages } - java: { description: "", name: Usages } - operations: - - &id224 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - UsageList: - parameters: - { - api-version: 2020-08-01-preview, - location: eastus2(stage), - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListLocationUsage.json - responses: - "200": - body: - value: - - name: { localizedValue: Storage Accounts, value: StorageAccounts } - currentValue: 55 - limit: 250 - unit: Count - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: { description: Gets the current usage count and the limit for the resources - of the location under the subscription., name: ListByLocation } - java: { description: Gets the current usage count and the limit for the resources - of the location under the subscription., name: listByLocation } - operationGroup: *id223 - operationId: Usages_ListByLocation - parameters: - - *id030 - - *id035 - - *id031 - - &id225 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The location of the Azure Storage resource., - name: location, - serializedName: location, - } - java: - { - description: The location of the Azure Storage resource., - name: location, - serializedName: location, - } - nullable: false - operation: *id224 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id032 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id035 - - *id031 - - *id225 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id224 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/locations/{location}/usages", - uri: "{$host}", - } - signatureParameters: - - *id225 - responses: - - language: - default: { description: OK -- current usage count and limit retrieved and returned - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id533 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The response from the List Usages operation., - name: UsageListResult, - namespace: "", - } - java: - { - description: The response from the List Usages operation., - name: UsageListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Gets or sets the list of Storage Resource Usages., - name: value, - } - java: - { - description: Gets or sets the list of Storage Resource Usages., - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id365 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id534 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: Describes Storage Resource Usage., - name: Usage, - namespace: "", - } - java: { description: Describes Storage Resource Usage., name: Usage } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the unit of measurement., name: unit } - java: { description: Gets the unit of measurement., name: unit } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SealedChoiceSchema &id587 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: COUNT } - value: Count - - language: - default: { description: "", name: BYTES } - value: Bytes - - language: - default: { description: "", name: SECONDS } - value: Seconds - - language: - default: { description: "", name: PERCENT } - value: Percent - - language: - default: { description: "", name: COUNTS_PER_SECOND } - value: CountsPerSecond - - language: - default: { description: "", name: BYTES_PER_SECOND } - value: BytesPerSecond - language: - default: - { description: Gets the unit of measurement., name: UsageUnit } - java: { description: Gets the unit of measurement., name: UsageUnit } - protocol: {} - type: SEALED_CHOICE - serializedName: unit - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the current count of the allocated resources - in the subscription., name: currentValue } - java: { description: Gets the current count of the allocated resources - in the subscription., name: currentValue } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id481 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: Gets the current count of the allocated - resources in the subscription., name: UsageCurrentValue } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: currentValue - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the maximum count of the resources that - can be allocated in the subscription., name: limit } - java: { description: Gets the maximum count of the resources that - can be allocated in the subscription., name: limit } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id482 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: Gets the maximum count of the resources - that can be allocated in the subscription., name: UsageLimit } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: limit - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the name of the type of usage., name: name } - java: { description: Gets the name of the type of usage., name: name } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id535 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The usage names that can be used; currently - limited to StorageAccount., name: UsageName, namespace: "" } - java: { description: The usage names that can be used; currently - limited to StorageAccount., name: UsageName } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets a string describing the resource - name., name: value } - java: - { - description: Gets a string describing the resource name., - name: value, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id676 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Gets a string describing the resource - name., name: UsageNameValue } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets a localized string describing the - resource name., name: localizedValue } - java: - { description: Gets a localized string describing the resource - name., name: localizedValue } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id677 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Gets a localized string describing - the resource name., name: UsageNameLocalizedValue } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: localizedValue - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - serializedName: name - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: Gets or sets the list of Storage Resource Usages., - name: UsageListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id225 - protocol: {} - - &id226 - $key: ManagementPolicies - codeModel: *id001 - language: - default: { description: "", name: ManagementPolicies } - java: { description: "", name: ManagementPolicies } - operations: - - &id227 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountGetManagementPolicies: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - managementPolicyName: default, - monitor: "true", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountGetManagementPolicy.json - responses: - "200": - body: - name: DefaultManagementPolicy - type: Microsoft.Storage/storageAccounts/managementPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/managementPolicies/default - properties: - lastModifiedTime: "2018-06-08T03:01:55.7168089Z" - policy: - rules: - - name: olcmtest - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 1000 } - tierToArchive: { daysAfterModificationGreaterThan: 90 } - tierToCool: { daysAfterModificationGreaterThan: 30 } - snapshot: - delete: { daysAfterCreationGreaterThan: 30 } - filters: - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer] - enabled: true - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets the managementpolicy associated with the specified - storage account., name: Get } - java: { description: Gets the managementpolicy associated with the specified - storage account., name: get } - operationGroup: *id226 - operationId: ManagementPolicies_Get - parameters: - - *id030 - - &id228 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id227 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id229 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id227 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id230 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the Storage Account Management Policy. - It should always be 'default', name: managementPolicyName, serializedName: managementPolicyName } - java: { description: The name of the Storage Account Management Policy. It - should always be 'default', name: managementPolicyName, serializedName: managementPolicyName } - nullable: false - operation: *id227 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id234 - apiVersions: [] - choiceType: *id010 - choices: - - language: - default: { description: "", name: DEFAULT } - value: default - language: - default: { description: "", name: ManagementPolicyName } - java: { description: "", name: ManagementPolicyName } - protocol: {} - type: CHOICE - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id228 - - *id229 - - *id035 - - *id031 - - *id230 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id227 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}", - uri: "{$host}", - } - signatureParameters: - - *id228 - - *id229 - - *id230 - responses: - - language: - default: { description: OK -- Get the managementpolicy successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id238 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The Get Storage Account ManagementPolicies operation - response., name: ManagementPolicy, namespace: "" } - java: { description: The Get Storage Account ManagementPolicies operation - response., name: ManagementPolicy } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - immediate: - - *id020 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: Returns the Storage Account Data Policies Rules., - name: properties, - } - java: - { - description: Returns the Storage Account Data Policies Rules., - name: properties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id540 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { - description: The Storage Account ManagementPolicy properties., - name: ManagementPolicyProperties, - namespace: "", - } - java: - { - description: The Storage Account ManagementPolicy properties., - name: ManagementPolicyProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Returns the date and time the ManagementPolicies - was last modified., name: lastModifiedTime } - java: { description: Returns the date and time the ManagementPolicies - was last modified., name: lastModifiedTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id463 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Returns the date and time the ManagementPolicies - was last modified., name: ManagementPolicyPropertiesLastModifiedTime } - protocol: {} - type: DATE_TIME - serializedName: lastModifiedTime - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The Storage Account ManagementPolicy, in JSON - format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.", name: policy } - java: { description: "The Storage Account ManagementPolicy, in JSON - format. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.", name: policy } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id541 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "The Storage Account ManagementPolicies Rules. - See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.", name: ManagementPolicySchema, namespace: "" } - java: { description: "The Storage Account ManagementPolicies Rules. - See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.", name: ManagementPolicySchema } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The Storage Account ManagementPolicies - Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.", name: rules } - java: { description: "The Storage Account ManagementPolicies Rules. - See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.", name: rules } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id369 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id542 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: An object that wraps the Lifecycle - rule. Each rule is uniquely defined by name., name: ManagementPolicyRule, namespace: "" } - java: { description: An object that wraps the Lifecycle rule. - Each rule is uniquely defined by name., name: ManagementPolicyRule } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Rule is enabled if set to true., - name: enabled, - } - java: - { - description: Rule is enabled if set to true., - name: enabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id403 - apiVersions: [] - language: - default: - { - description: Rule is enabled if set to true., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: enabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A rule name can contain any combination - of alpha numeric characters. Rule name is case-sensitive. - It must be unique within a policy., name: name } - java: { description: A rule name can contain any combination - of alpha numeric characters. Rule name is case-sensitive. - It must be unique within a policy., name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id695 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: A rule name can contain any combination - of alpha numeric characters. Rule name is case-sensitive. - It must be unique within a policy., name: ManagementPolicyRuleName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The valid value is Lifecycle, name: type } - java: - { description: The valid value is Lifecycle, name: type } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id436 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: LIFECYCLE } - value: Lifecycle - language: - default: - { - description: The valid value is Lifecycle, - name: RuleType, - } - java: - { - description: The valid value is Lifecycle, - name: RuleType, - } - protocol: {} - type: CHOICE - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An object that defines the Lifecycle - rule., name: definition } - java: { description: An object that defines the Lifecycle - rule., name: definition } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id543 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: An object that defines the Lifecycle - rule. Each definition is made up with a filters set - and an actions set., name: ManagementPolicyDefinition, namespace: "" } - java: { description: An object that defines the Lifecycle - rule. Each definition is made up with a filters set - and an actions set., name: ManagementPolicyDefinition } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: An object that defines the action - set., name: actions } - java: { description: An object that defines the action - set., name: actions } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id544 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: Actions are applied to the - filtered blobs when the execution condition is - met., name: ManagementPolicyAction, namespace: "" } - java: - { description: Actions are applied to the filtered - blobs when the execution condition is met., name: ManagementPolicyAction } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The management policy action - for base blob, name: baseBlob } - java: - { description: The management policy action - for base blob, name: baseBlob } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id545 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Management policy action - for base blob., name: ManagementPolicyBaseBlob, namespace: "" } - java: - { description: Management policy action for - base blob., name: ManagementPolicyBaseBlob } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to tier - blobs to cool storage. Support blobs currently - at Hot tier, name: tierToCool } - java: - { - description: - The function to tier blobs - to cool storage. Support blobs currently - at Hot tier, - name: tierToCool, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id231 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Object to define the - number of days after object last modification - Or last access. Properties daysAfterModificationGreaterThan - and daysAfterLastAccessTimeGreaterThan - are mutually exclusive., name: DateAfterModification, namespace: "" } - java: - { - description: - Object to define the number - of days after object last modification - Or last access. Properties daysAfterModificationGreaterThan - and daysAfterLastAccessTimeGreaterThan - are mutually exclusive., - name: DateAfterModification, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Value indicating - the age in days after last modification, name: daysAfterModificationGreaterThan } - java: - { - description: - Value indicating the - age in days after last modification, - name: daysAfterModificationGreaterThan, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id483 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: Value indicating - the age in days after last modification, name: DateAfterModificationDaysAfterModificationGreaterThan } - maximum: 0.0 - minimum: 0.0 - multipleOf: 1.0 - precision: 32.0 - protocol: {} - type: NUMBER - serializedName: daysAfterModificationGreaterThan - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Value indicating - the age in days after last blob access. - This property can only be used in conjunction - with last access time tracking policy, name: daysAfterLastAccessTimeGreaterThan } - java: - { - description: - Value indicating the - age in days after last blob access. - This property can only be used in conjunction - with last access time tracking policy, - name: daysAfterLastAccessTimeGreaterThan, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id484 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: Value indicating - the age in days after last blob access. - This property can only be used in - conjunction with last access time - tracking policy, name: DateAfterModificationDaysAfterLastAccessTimeGreaterThan } - maximum: 0.0 - minimum: 0.0 - multipleOf: 1.0 - precision: 32.0 - protocol: {} - type: NUMBER - serializedName: daysAfterLastAccessTimeGreaterThan - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: tierToCool - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to tier - blobs to archive storage. Support blobs - currently at Hot or Cool tier, name: tierToArchive } - java: - { - description: - The function to tier blobs - to archive storage. Support blobs currently - at Hot or Cool tier, - name: tierToArchive, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id231 - serializedName: tierToArchive - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to delete - the blob, name: delete } - java: - { - description: - The function to delete the - blob, - name: delete, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id231 - serializedName: delete - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: This property enables - auto tiering of a blob from cool to hot - on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan., name: enableAutoTierToHotFromCool } - java: - { - description: - This property enables auto - tiering of a blob from cool to hot on a - blob access. This property requires tierToCool.daysAfterLastAccessTimeGreaterThan., - name: enableAutoTierToHotFromCool, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id404 - apiVersions: [] - language: - default: - { description: This property enables - auto tiering of a blob from cool to hot - on a blob access. This property requires - tierToCool.daysAfterLastAccessTimeGreaterThan., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enableAutoTierToHotFromCool - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: baseBlob - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The management policy action - for snapshot, name: snapshot } - java: - { description: The management policy action - for snapshot, name: snapshot } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id546 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Management policy action - for snapshot., name: ManagementPolicySnapShot, namespace: "" } - java: - { description: Management policy action for - snapshot., name: ManagementPolicySnapShot } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to tier - blob snapshot to cool storage. Support blob - snapshot currently at Hot tier, name: tierToCool } - java: - { description: The function to tier blob - snapshot to cool storage. Support blob snapshot - currently at Hot tier, name: tierToCool } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id232 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Object to define the - number of days after creation., name: DateAfterCreation, namespace: "" } - java: - { - description: - Object to define the number - of days after creation., - name: DateAfterCreation, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Value indicating - the age in days after creation, name: daysAfterCreationGreaterThan } - java: - { - description: - Value indicating the - age in days after creation, - name: daysAfterCreationGreaterThan, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id485 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: Value indicating - the age in days after creation, name: DateAfterCreationDaysAfterCreationGreaterThan } - maximum: 0.0 - minimum: 0.0 - multipleOf: 1.0 - precision: 32.0 - protocol: {} - type: NUMBER - serializedName: daysAfterCreationGreaterThan - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: tierToCool - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to tier - blob snapshot to archive storage. Support - blob snapshot currently at Hot or Cool tier, name: tierToArchive } - java: - { description: The function to tier blob - snapshot to archive storage. Support blob - snapshot currently at Hot or Cool tier, name: tierToArchive } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id232 - serializedName: tierToArchive - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to delete - the blob snapshot, name: delete } - java: - { - description: - The function to delete the - blob snapshot, - name: delete, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id232 - serializedName: delete - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: snapshot - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The management policy action - for version, name: version } - java: - { description: The management policy action - for version, name: version } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id547 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { description: Management policy action - for blob version., name: ManagementPolicyVersion, namespace: "" } - java: - { description: Management policy action for - blob version., name: ManagementPolicyVersion } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to tier - blob version to cool storage. Support blob - version currently at Hot tier, name: tierToCool } - java: - { description: The function to tier blob - version to cool storage. Support blob version - currently at Hot tier, name: tierToCool } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id232 - serializedName: tierToCool - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to tier - blob version to archive storage. Support - blob version currently at Hot or Cool tier, name: tierToArchive } - java: - { description: The function to tier blob - version to archive storage. Support blob - version currently at Hot or Cool tier, name: tierToArchive } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id232 - serializedName: tierToArchive - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: The function to delete - the blob version, name: delete } - java: - { - description: - The function to delete the - blob version, - name: delete, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id232 - serializedName: delete - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: version - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: actions - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: An object that defines the filter - set., name: filters } - java: { description: An object that defines the filter - set., name: filters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id548 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "Filters limit rule actions - to a subset of blobs within the storage account. - If multiple filters are defined, a logical AND - is performed on all filters. ", name: ManagementPolicyFilter, namespace: "" } - java: { description: "Filters limit rule actions to - a subset of blobs within the storage account. - If multiple filters are defined, a logical AND - is performed on all filters. ", name: ManagementPolicyFilter } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: - An array of strings for prefixes - to be match., - name: prefixMatch, - } - java: - { - description: - An array of strings for prefixes - to be match., - name: prefixMatch, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id366 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id696 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: ManagementPolicyFilterPrefixMatchItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: An array of strings for - prefixes to be match., name: ManagementPolicyFilterPrefixMatch } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: prefixMatch - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: An array of predefined enum - values. Currently blockBlob supports all tiering - and delete actions. Only delete actions are - supported for appendBlob., name: blobTypes } - java: { description: An array of predefined enum - values. Currently blockBlob supports all tiering - and delete actions. Only delete actions are - supported for appendBlob., name: blobTypes } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id367 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id697 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: ManagementPolicyFilterBlobTypesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: An array of predefined - enum values. Currently blockBlob supports - all tiering and delete actions. Only delete - actions are supported for appendBlob., name: ManagementPolicyFilterBlobTypes } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: blobTypes - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "An array of blob index tag - based filters, there can be at most 10 tag filters", name: blobIndexMatch } - java: { description: "An array of blob index tag - based filters, there can be at most 10 tag filters", name: blobIndexMatch } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id368 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id549 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: Blob index tag based - filtering for blob objects, name: TagFilter, namespace: "" } - java: - { - description: - Blob index tag based filtering - for blob objects, - name: TagFilter, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "This is the filter - tag name, it can have 1 - 128 characters", name: name } - java: - { description: "This is the filter tag - name, it can have 1 - 128 characters", name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id698 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: "This is the filter - tag name, it can have 1 - 128 characters", name: TagFilterName } - maxLength: 128.0 - minLength: 1.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: This is the comparison - operator which is used for object comparison - and filtering. Only == (equality operator) - is currently supported, name: op } - java: - { description: This is the comparison - operator which is used for object comparison - and filtering. Only == (equality operator) - is currently supported, name: op } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id699 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: - This is the comparison - operator which is used for object comparison - and filtering. Only == (equality operator) - is currently supported, - name: TagFilterOp, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: op - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "This is the filter - tag value field used for tag based filtering, - it can have 0 - 256 characters", name: value } - java: - { description: "This is the filter tag - value field used for tag based filtering, - it can have 0 - 256 characters", name: value } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id700 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: "This is the filter - tag value field used for tag based filtering, - it can have 0 - 256 characters", name: TagFilterValue } - maxLength: 256.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { description: "An array of blob index - tag based filters, there can be at most 10 - tag filters", name: ManagementPolicyFilterBlobIndexMatch } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: blobIndexMatch - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: filters - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: definition - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: { description: "The Storage Account ManagementPolicies - Rules. See more details in: https://docs.microsoft.com/en-us/azure/storage/common/storage-lifecycle-managment-concepts.", name: ManagementPolicySchemaRules } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: rules - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: policy - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - signatureParameters: - - *id228 - - *id229 - - *id230 - - &id233 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountSetManagementPolicyWithSnapshotAndVersion: - parameters: - accountName: sto9699 - api-version: 2020-08-01-preview - managementPolicyName: default - monitor: "true" - properties: - properties: - policy: - rules: - - name: olcmtest1 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 1000 } - tierToArchive: { daysAfterModificationGreaterThan: 90 } - tierToCool: { daysAfterModificationGreaterThan: 30 } - snapshot: - delete: { daysAfterCreationGreaterThan: 1000 } - tierToArchive: { daysAfterCreationGreaterThan: 90 } - tierToCool: { daysAfterCreationGreaterThan: 30 } - version: - delete: { daysAfterCreationGreaterThan: 1000 } - tierToArchive: { daysAfterCreationGreaterThan: 90 } - tierToCool: { daysAfterCreationGreaterThan: 30 } - filters: - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer1] - enabled: true - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountSetManagementPolicyWithSnapshotAndVersion.json - responses: - "200": - body: - name: DefaultManagementPolicy - type: Microsoft.Storage/storageAccounts/managementPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/managementPolicies/default - properties: - lastModifiedTime: "2018-06-08T02:53:39.0932539Z" - policy: - rules: - - name: olcmtest1 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 1000 } - tierToArchive: { daysAfterModificationGreaterThan: 90 } - tierToCool: { daysAfterModificationGreaterThan: 30 } - snapshot: - delete: { daysAfterCreationGreaterThan: 1000 } - tierToArchive: { daysAfterCreationGreaterThan: 90 } - tierToCool: { daysAfterCreationGreaterThan: 30 } - version: - delete: { daysAfterCreationGreaterThan: 1000 } - tierToArchive: { daysAfterCreationGreaterThan: 90 } - tierToCool: { daysAfterCreationGreaterThan: 30 } - filters: - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer1] - enabled: true - StorageAccountSetManagementPolicyForBlockAndAppendBlobs: - parameters: - accountName: sto9699 - api-version: 2020-08-01-preview - managementPolicyName: default - monitor: "true" - properties: - properties: - policy: - rules: - - name: olcmtest1 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 90 } - snapshot: - delete: { daysAfterCreationGreaterThan: 90 } - version: - delete: { daysAfterCreationGreaterThan: 90 } - filters: - blobTypes: [blockBlob, appendBlob] - prefixMatch: [olcmtestcontainer1] - enabled: true - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountSetManagementPolicyForBlockAndAppendBlobs.json - responses: - "200": - body: - name: DefaultManagementPolicy - type: Microsoft.Storage/storageAccounts/managementPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/managementPolicies/default - properties: - lastModifiedTime: "2018-06-08T02:53:39.0932539Z" - policy: - rules: - - name: olcmtest1 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 90 } - snapshot: - delete: { daysAfterCreationGreaterThan: 90 } - version: - delete: { daysAfterCreationGreaterThan: 90 } - filters: - blobTypes: [blockBlob, appendBlob] - prefixMatch: [olcmtestcontainer1] - enabled: true - StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions: - parameters: - accountName: sto9699 - api-version: 2020-08-01-preview - managementPolicyName: default - monitor: "true" - properties: - properties: - policy: - rules: - - name: olcmtest - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterLastAccessTimeGreaterThan: 1000 } - enableAutoTierToHotFromCool: true - tierToArchive: { daysAfterLastAccessTimeGreaterThan: 90 } - tierToCool: { daysAfterLastAccessTimeGreaterThan: 30 } - snapshot: - delete: { daysAfterCreationGreaterThan: 30 } - filters: - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer] - enabled: true - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountSetManagementPolicy_LastAccessTimeBasedBlobActions.json - responses: - "200": - body: - name: DefaultManagementPolicy - type: Microsoft.Storage/storageAccounts/managementPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/managementPolicies/default - properties: - lastModifiedTime: "2018-06-08T02:53:39.0932539Z" - policy: - rules: - - name: olcmtest - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterLastAccessTimeGreaterThan: 1000 } - enableAutoTierToHotFromCool: true - tierToArchive: { daysAfterLastAccessTimeGreaterThan: 90 } - tierToCool: { daysAfterLastAccessTimeGreaterThan: 30 } - snapshot: - delete: { daysAfterCreationGreaterThan: 30 } - filters: - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer] - enabled: true - StorageAccountSetManagementPolicies: - parameters: - accountName: sto9699 - api-version: 2020-08-01-preview - managementPolicyName: default - monitor: "true" - properties: - properties: - policy: - rules: - - name: olcmtest1 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 1000 } - tierToArchive: { daysAfterModificationGreaterThan: 90 } - tierToCool: { daysAfterModificationGreaterThan: 30 } - snapshot: - delete: { daysAfterCreationGreaterThan: 30 } - filters: - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer1] - enabled: true - - name: olcmtest2 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 1000 } - tierToArchive: { daysAfterModificationGreaterThan: 90 } - tierToCool: { daysAfterModificationGreaterThan: 30 } - filters: - blobIndexMatch: - - { name: tag1, op: ==, value: val1 } - - { name: tag2, op: ==, value: val2 } - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer2] - enabled: true - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountSetManagementPolicy.json - responses: - "200": - body: - name: DefaultManagementPolicy - type: Microsoft.Storage/storageAccounts/managementPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/managementPolicies/default - properties: - lastModifiedTime: "2018-06-08T02:53:39.0932539Z" - policy: - rules: - - name: olcmtest1 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 1000 } - tierToArchive: { daysAfterModificationGreaterThan: 90 } - tierToCool: { daysAfterModificationGreaterThan: 30 } - snapshot: - delete: { daysAfterCreationGreaterThan: 30 } - filters: - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer1] - enabled: true - - name: olcmtest2 - type: Lifecycle - definition: - actions: - baseBlob: - delete: { daysAfterModificationGreaterThan: 1000 } - tierToArchive: { daysAfterModificationGreaterThan: 90 } - tierToCool: { daysAfterModificationGreaterThan: 30 } - filters: - blobIndexMatch: - - { name: tag1, op: ==, value: val1 } - - { name: tag2, op: ==, value: val2 } - blobTypes: [blockBlob] - prefixMatch: [olcmtestcontainer2] - enabled: true - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { - description: Sets the managementpolicy to the specified storage account., - name: CreateOrUpdate, - } - java: - { - description: Sets the managementpolicy to the specified storage account., - name: createOrUpdate, - } - operationGroup: *id226 - operationId: ManagementPolicies_CreateOrUpdate - parameters: - - *id030 - - &id235 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id233 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id236 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id233 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id237 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the Storage Account Management Policy. - It should always be 'default', name: managementPolicyName, serializedName: managementPolicyName } - java: { description: The name of the Storage Account Management Policy. It - should always be 'default', name: managementPolicyName, serializedName: managementPolicyName } - nullable: false - operation: *id233 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id234 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id235 - - *id236 - - *id035 - - *id031 - - *id237 - - &id239 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The ManagementPolicy set to a storage account., - name: properties, - } - java: - { - description: The ManagementPolicy set to a storage account., - name: properties, - } - nullable: false - operation: *id233 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id238 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id233 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName} - uri: "{$host}" - signatureParameters: - - *id235 - - *id236 - - *id237 - - *id239 - responses: - - language: - default: { description: OK -- Put managementpolicy successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id238 - signatureParameters: - - *id235 - - *id236 - - *id237 - - &id240 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountDeleteManagementPolicies: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - managementPolicyName: default, - monitor: "true", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountDeleteManagementPolicy.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes the managementpolicy associated with the specified - storage account., name: Delete } - java: { description: Deletes the managementpolicy associated with the specified - storage account., name: delete } - operationGroup: *id226 - operationId: ManagementPolicies_Delete - parameters: - - *id030 - - &id241 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id240 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id242 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id240 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id243 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the Storage Account Management Policy. - It should always be 'default', name: managementPolicyName, serializedName: managementPolicyName } - java: { description: The name of the Storage Account Management Policy. It - should always be 'default', name: managementPolicyName, serializedName: managementPolicyName } - nullable: false - operation: *id240 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id234 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id241 - - *id242 - - *id035 - - *id031 - - *id243 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/managementPolicies/{managementPolicyName}", - uri: "{$host}", - } - signatureParameters: - - *id241 - - *id242 - - *id243 - responses: - - language: - default: { description: OK -- Delete the managementpolicy successfully., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content -- The managementpolicy does not exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id241 - - *id242 - - *id243 - protocol: {} - - &id244 - $key: BlobInventoryPolicies - codeModel: *id001 - language: - default: { description: "", name: BlobInventoryPolicies } - java: { description: "", name: BlobInventoryPolicies } - operations: - - &id245 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountGetBlobInventoryPolicy: - parameters: - { - accountName: sto9699, - api-version: 2020-08-01-preview, - blobInventoryPolicyName: default, - monitor: "true", - resourceGroupName: res7687, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountGetBlobInventoryPolicy.json - responses: - "200": - body: - name: DefaultInventoryPolicy - type: Microsoft.Storage/storageAccounts/inventoryPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default - properties: - lastModifiedTime: "2020-10-05T02:53:39.0932539Z" - policy: - type: Inventory - destination: containerName - enabled: true - rules: - - name: inventoryPolicyRule1 - definition: - filters: - blobTypes: [blockBlob, appendBlob, pageBlob] - includeBlobVersions: true - includeSnapshots: true - prefixMatch: [inventoryprefix1, inventoryprefix2] - enabled: true - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets the blob inventory policy associated with the specified - storage account., name: Get } - java: { description: Gets the blob inventory policy associated with the specified - storage account., name: get } - operationGroup: *id244 - operationId: BlobInventoryPolicies_Get - parameters: - - *id030 - - &id246 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id245 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id247 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id245 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id248 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account blob inventory policy. - It should always be 'default', name: blobInventoryPolicyName, serializedName: blobInventoryPolicyName } - java: { description: The name of the storage account blob inventory policy. - It should always be 'default', name: blobInventoryPolicyName, serializedName: blobInventoryPolicyName } - nullable: false - operation: *id245 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id251 - apiVersions: [] - choiceType: *id010 - choices: - - language: - default: { description: "", name: DEFAULT } - value: default - language: - default: { description: "", name: BlobInventoryPolicyName } - java: { description: "", name: BlobInventoryPolicyName } - protocol: {} - type: CHOICE - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id246 - - *id247 - - *id035 - - *id031 - - *id248 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id245 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}", - uri: "{$host}", - } - signatureParameters: - - *id246 - - *id247 - - *id248 - responses: - - language: - default: { description: OK -- Get the blob inventory policy successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id255 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The storage account blob inventory policy., - name: BlobInventoryPolicy, - namespace: "", - } - java: - { - description: The storage account blob inventory policy., - name: BlobInventoryPolicy, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - immediate: - - *id020 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Returns the storage account blob inventory policy - rules., name: properties } - java: { description: Returns the storage account blob inventory policy - rules., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id550 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { - description: The storage account blob inventory policy properties., - name: BlobInventoryPolicyProperties, - namespace: "", - } - java: - { - description: The storage account blob inventory policy properties., - name: BlobInventoryPolicyProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Returns the last modified date and time of - the blob inventory policy., name: lastModifiedTime } - java: { description: Returns the last modified date and time of the - blob inventory policy., name: lastModifiedTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id464 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Returns the last modified date and time of - the blob inventory policy., name: BlobInventoryPolicyPropertiesLastModifiedTime } - protocol: {} - type: DATE_TIME - serializedName: lastModifiedTime - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The storage account blob inventory policy object. - It is composed of policy rules., name: policy } - java: { description: The storage account blob inventory policy object. - It is composed of policy rules., name: policy } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id551 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The storage account blob inventory policy - rules., name: BlobInventoryPolicySchema, namespace: "" } - java: - { - description: The storage account blob inventory policy rules., - name: BlobInventoryPolicySchema, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Policy is enabled if set to true., name: enabled } - java: - { description: Policy is enabled if set to true., name: enabled } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id405 - apiVersions: [] - language: - default: - { - description: Policy is enabled if set to true., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: enabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Container name where blob inventory files - are stored. Must be pre-created., name: destination } - java: { description: Container name where blob inventory files - are stored. Must be pre-created., name: destination } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id701 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Container name where blob inventory files - are stored. Must be pre-created., name: BlobInventoryPolicySchemaDestination } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: destination - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The valid value is Inventory, name: type } - java: { description: The valid value is Inventory, name: type } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id437 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: INVENTORY } - value: Inventory - language: - default: - { - description: The valid value is Inventory, - name: InventoryRuleType, - } - java: - { - description: The valid value is Inventory, - name: InventoryRuleType, - } - protocol: {} - type: CHOICE - serializedName: type - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The storage account blob inventory policy - rules. The rule is applied when it is enabled., name: rules } - java: { description: The storage account blob inventory policy - rules. The rule is applied when it is enabled., name: rules } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id372 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id552 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: An object that wraps the blob inventory - rule. Each rule is uniquely defined by name., name: BlobInventoryPolicyRule, namespace: "" } - java: { description: An object that wraps the blob inventory - rule. Each rule is uniquely defined by name., name: BlobInventoryPolicyRule } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Rule is enabled when set to true., - name: enabled, - } - java: - { - description: Rule is enabled when set to true., - name: enabled, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id406 - apiVersions: [] - language: - default: - { - description: Rule is enabled when set to true., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: enabled - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A rule name can contain any combination - of alpha numeric characters. Rule name is case-sensitive. - It must be unique within a policy., name: name } - java: { description: A rule name can contain any combination - of alpha numeric characters. Rule name is case-sensitive. - It must be unique within a policy., name: name } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id702 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { description: A rule name can contain any combination - of alpha numeric characters. Rule name is case-sensitive. - It must be unique within a policy., name: BlobInventoryPolicyRuleName } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: An object that defines the blob inventory - policy rule., name: definition } - java: - { description: An object that defines the blob inventory - policy rule., name: definition } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id553 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: An object that defines the blob - inventory rule. Each definition consists of a set - of filters., name: BlobInventoryPolicyDefinition, namespace: "" } - java: - { description: An object that defines the blob inventory - rule. Each definition consists of a set of filters., name: BlobInventoryPolicyDefinition } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: An object that defines the filter - set., name: filters } - java: { description: An object that defines the filter - set., name: filters } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id554 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: An object that defines the - blob inventory rule filter conditions., name: BlobInventoryPolicyFilter, namespace: "" } - java: { description: An object that defines the blob - inventory rule filter conditions., name: BlobInventoryPolicyFilter } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: An array of strings for blob - prefixes to be matched., name: prefixMatch } - java: - { description: An array of strings for blob - prefixes to be matched., name: prefixMatch } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id370 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id703 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: BlobInventoryPolicyFilterPrefixMatchItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: An array of strings for - blob prefixes to be matched., name: BlobInventoryPolicyFilterPrefixMatch } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: prefixMatch - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "An array of predefined enum - values. Valid values include blockBlob, appendBlob, - pageBlob. Hns accounts does not support pageBlobs.", name: blobTypes } - java: - { description: "An array of predefined enum - values. Valid values include blockBlob, appendBlob, - pageBlob. Hns accounts does not support pageBlobs.", name: blobTypes } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id371 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id704 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: BlobInventoryPolicyFilterBlobTypesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: "An array of predefined - enum values. Valid values include blockBlob, - appendBlob, pageBlob. Hns accounts does not - support pageBlobs.", name: BlobInventoryPolicyFilterBlobTypes } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: blobTypes - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Includes blob versions in - blob inventory when value set to true., name: includeBlobVersions } - java: - { description: Includes blob versions in blob - inventory when value set to true., name: includeBlobVersions } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id407 - apiVersions: [] - language: - default: { description: Includes blob versions - in blob inventory when value set to true., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: includeBlobVersions - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Includes blob snapshots in - blob inventory when value set to true., name: includeSnapshots } - java: - { description: Includes blob snapshots in blob - inventory when value set to true., name: includeSnapshots } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id408 - apiVersions: [] - language: - default: - { description: Includes blob snapshots - in blob inventory when value set to true., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: includeSnapshots - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: filters - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: definition - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: { description: The storage account blob inventory policy - rules. The rule is applied when it is enabled., name: BlobInventoryPolicySchemaRules } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: rules - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: policy - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Metadata pertaining to creation and last modification - of the resource., name: systemData } - java: { description: Metadata pertaining to creation and last modification - of the resource., name: systemData } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id555 - apiVersions: - - { version: "2.0" } - flattenedSchema: false - language: - default: { description: Metadata pertaining to creation and last modification - of the resource., name: SystemData, namespace: "" } - java: { description: Metadata pertaining to creation and last modification - of the resource., name: SystemData } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The identity that created the resource., - name: createdBy, - } - java: - { - description: The identity that created the resource., - name: createdBy, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id705 - apiVersions: - - { version: "2.0" } - language: - default: - { - description: The identity that created the resource., - name: SystemDataCreatedBy, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: createdBy - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The type of identity that created the resource., - name: createdByType, - } - java: - { - description: The type of identity that created the resource., - name: createdByType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id249 - apiVersions: - - { version: "2.0" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: USER } - value: User - - language: - default: { description: "", name: APPLICATION } - value: Application - - language: - default: { description: "", name: MANAGED_IDENTITY } - value: ManagedIdentity - - language: - default: { description: "", name: KEY } - value: Key - language: - default: - { - description: The type of identity that created the resource., - name: CreatedByType, - } - java: - { - description: The type of identity that created the resource., - name: CreatedByType, - } - protocol: {} - type: CHOICE - serializedName: createdByType - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The timestamp of resource creation (UTC)., - name: createdAt, - } - java: - { - description: The timestamp of resource creation (UTC)., - name: createdAt, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id465 - apiVersions: - - { version: "2.0" } - format: DATE_TIME - language: - default: - { - description: The timestamp of resource creation (UTC)., - name: SystemDataCreatedAt, - } - protocol: {} - type: DATE_TIME - serializedName: createdAt - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The identity that last modified the resource., - name: lastModifiedBy, - } - java: - { - description: The identity that last modified the resource., - name: lastModifiedBy, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id706 - apiVersions: - - { version: "2.0" } - language: - default: - { - description: The identity that last modified the resource., - name: SystemDataLastModifiedBy, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: lastModifiedBy - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The type of identity that last modified the - resource., name: lastModifiedByType } - java: - { - description: The type of identity that last modified the resource., - name: lastModifiedByType, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id249 - serializedName: lastModifiedByType - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The timestamp of resource last modification - (UTC), name: lastModifiedAt } - java: - { - description: The timestamp of resource last modification (UTC), - name: lastModifiedAt, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id466 - apiVersions: - - { version: "2.0" } - format: DATE_TIME - language: - default: { description: The timestamp of resource last modification - (UTC), name: SystemDataLastModifiedAt } - protocol: {} - type: DATE_TIME - serializedName: lastModifiedAt - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: systemData - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - signatureParameters: - - *id246 - - *id247 - - *id248 - - &id250 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountSetBlobInventoryPolicy: - parameters: - accountName: sto9699 - api-version: 2020-08-01-preview - blobInventoryPolicyName: default - monitor: "true" - properties: - properties: - policy: - type: Inventory - destination: containerName - enabled: true - rules: - - name: inventoryPolicyRule1 - definition: - filters: - blobTypes: [blockBlob, appendBlob, pageBlob] - includeBlobVersions: true - includeSnapshots: true - prefixMatch: [inventoryprefix1, inventoryprefix2] - enabled: true - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountSetBlobInventoryPolicy.json - responses: - "200": - body: - name: DefaultInventoryPolicy - type: Microsoft.Storage/storageAccounts/inventoryPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default - properties: - lastModifiedTime: "2020-10-05T02:53:39.0932539Z" - policy: - type: Inventory - destination: containerName - enabled: true - rules: - - name: inventoryPolicyRule1 - definition: - filters: - blobTypes: [blockBlob, appendBlob, pageBlob] - includeBlobVersions: true - includeSnapshots: true - prefixMatch: [inventoryprefix1, inventoryprefix2] - enabled: true - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Sets the blob inventory policy to the specified storage - account., name: CreateOrUpdate } - java: { description: Sets the blob inventory policy to the specified storage - account., name: createOrUpdate } - operationGroup: *id244 - operationId: BlobInventoryPolicies_CreateOrUpdate - parameters: - - *id030 - - &id252 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id250 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id253 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id250 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id254 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account blob inventory policy. - It should always be 'default', name: blobInventoryPolicyName, serializedName: blobInventoryPolicyName } - java: { description: The name of the storage account blob inventory policy. - It should always be 'default', name: blobInventoryPolicyName, serializedName: blobInventoryPolicyName } - nullable: false - operation: *id250 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id251 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id252 - - *id253 - - *id035 - - *id031 - - *id254 - - &id256 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: The blob inventory policy set to a storage account., - name: properties, - } - java: - { - description: The blob inventory policy set to a storage account., - name: properties, - } - nullable: false - operation: *id250 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id255 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id250 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName} - uri: "{$host}" - signatureParameters: - - *id252 - - *id253 - - *id254 - - *id256 - responses: - - language: - default: { description: OK -- Put blob inventory policy successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id255 - signatureParameters: - - *id252 - - *id253 - - *id254 - - &id257 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountDeleteBlobInventoryPolicy: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - blobInventoryPolicyName: default, - monitor: "true", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountDeleteBlobInventoryPolicy.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes the blob inventory policy associated with the - specified storage account., name: Delete } - java: { description: Deletes the blob inventory policy associated with the specified - storage account., name: delete } - operationGroup: *id244 - operationId: BlobInventoryPolicies_Delete - parameters: - - *id030 - - &id258 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id257 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id259 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id257 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id260 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account blob inventory policy. - It should always be 'default', name: blobInventoryPolicyName, serializedName: blobInventoryPolicyName } - java: { description: The name of the storage account blob inventory policy. - It should always be 'default', name: blobInventoryPolicyName, serializedName: blobInventoryPolicyName } - nullable: false - operation: *id257 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id251 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id258 - - *id259 - - *id035 - - *id031 - - *id260 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id257 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies/{blobInventoryPolicyName}", - uri: "{$host}", - } - signatureParameters: - - *id258 - - *id259 - - *id260 - responses: - - language: - default: - { description: OK -- Delete the blob inventory policy successfully., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: - { description: No Content -- The blob inventory policy does not exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id258 - - *id259 - - *id260 - - &id261 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountGetBlobInventoryPolicy: - parameters: - { - accountName: sto9699, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res7687, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListBlobInventoryPolicy.json - responses: - "200": - body: - value: - - name: DefaultInventoryPolicy - type: Microsoft.Storage/storageAccounts/inventoryPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/sto9699/inventoryPolicies/default - properties: - lastModifiedTime: "2020-10-05T02:53:39.0932539Z" - policy: - type: Inventory - destination: containerName - enabled: true - rules: - - name: inventoryPolicyRule1 - definition: - filters: - blobTypes: [blockBlob, appendBlob, pageBlob] - includeBlobVersions: true - includeSnapshots: true - prefixMatch: [inventoryprefix1, inventoryprefix2] - enabled: true - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: { description: Gets the blob inventory policy associated with the specified - storage account., name: List } - java: { description: Gets the blob inventory policy associated with the specified - storage account., name: list } - operationGroup: *id244 - operationId: BlobInventoryPolicies_List - parameters: - - *id030 - - &id262 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id261 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id263 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id261 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id262 - - *id263 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id261 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/inventoryPolicies", - uri: "{$host}", - } - signatureParameters: - - *id262 - - *id263 - responses: - - language: - default: - { description: OK -- Get the blob inventory policies successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id556 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: List of blob inventory policies returned., - name: ListBlobInventoryPolicy, - namespace: "", - } - java: - { - description: List of blob inventory policies returned., - name: ListBlobInventoryPolicy, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: List of blob inventory policies., name: value } - java: { description: List of blob inventory policies., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id373 - apiVersions: - - { version: "2021-01-01" } - elementType: *id255 - language: - default: - { - description: List of blob inventory policies., - name: ListBlobInventoryPolicyValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id262 - - *id263 - protocol: {} - - &id264 - $key: PrivateEndpointConnections - codeModel: *id001 - language: - default: { description: "", name: PrivateEndpointConnections } - java: { description: "", name: PrivateEndpointConnections } - operations: - - &id265 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountListPrivateEndpointConnections: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListPrivateEndpointConnections.json - responses: - "200": - body: - value: - - name: "{privateEndpointConnectionName}" - type: Microsoft.Storage/storageAccounts/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01", - } - privateLinkServiceConnectionState: - { description: Auto-Approved, actionRequired: None, status: Approved } - provisioningState: Succeeded - - name: "{privateEndpointConnectionName}" - type: Microsoft.Storage/storageAccounts/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest02", - } - privateLinkServiceConnectionState: - { description: Auto-Approved, actionRequired: None, status: Approved } - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: { description: List all the private endpoint connections associated - with the storage account., name: List } - java: { description: List all the private endpoint connections associated with - the storage account., name: list } - operationGroup: *id264 - operationId: PrivateEndpointConnections_List - parameters: - - *id030 - - &id266 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id265 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id267 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id265 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id266 - - *id267 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id265 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections", - uri: "{$host}", - } - signatureParameters: - - *id266 - - *id267 - responses: - - language: - default: - { - description: OK -- Successfully retrieved private endpoint connections., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id557 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: List of private endpoint connection associated with - the specified storage account, name: PrivateEndpointConnectionListResult, namespace: "" } - java: { description: List of private endpoint connection associated with - the specified storage account, name: PrivateEndpointConnectionListResult } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Array of private endpoint connections, name: value } - java: { description: Array of private endpoint connections, name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id374 - apiVersions: - - { version: "2021-01-01" } - elementType: *id268 - language: - default: - { - description: Array of private endpoint connections, - name: PrivateEndpointConnectionListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id266 - - *id267 - - &id269 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountGetPrivateEndpointConnection: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - monitor: "true", - privateEndpointConnectionName: "{privateEndpointConnectionName}", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountGetPrivateEndpointConnection.json - responses: - "200": - body: - name: "{privateEndpointConnectionName}" - type: Microsoft.Storage/storageAccounts/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01", - } - privateLinkServiceConnectionState: - { description: Auto-Approved, actionRequired: None, status: Approved } - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets the specified private endpoint connection associated - with the storage account., name: Get } - java: { description: Gets the specified private endpoint connection associated - with the storage account., name: get } - operationGroup: *id264 - operationId: PrivateEndpointConnections_Get - parameters: - - *id030 - - &id270 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id269 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id271 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id269 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id272 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - java: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - nullable: false - operation: *id269 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id274 - apiVersions: - - { version: "1.0" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id270 - - *id271 - - *id035 - - *id031 - - *id272 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id269 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", - uri: "{$host}", - } - signatureParameters: - - *id270 - - *id271 - - *id272 - responses: - - language: - default: { description: OK -- Get the private endpoint connection properties - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id268 - signatureParameters: - - *id270 - - *id271 - - *id272 - - &id273 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountPutPrivateEndpointConnection: - parameters: - accountName: sto9699 - api-version: 2020-08-01-preview - monitor: "true" - privateEndpointConnectionName: "{privateEndpointConnectionName}" - properties: - properties: - privateLinkServiceConnectionState: - { description: Auto-Approved, status: Approved } - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountPutPrivateEndpointConnection.json - responses: - "200": - body: - name: "{privateEndpointConnectionName}" - type: Microsoft.Storage/storageAccounts/privateEndpointConnections - id: /subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Storage/storageAccounts/sto288/privateEndpointConnections/{privateEndpointConnectionName} - properties: - privateEndpoint: - { - id: "/subscriptions/{subscription-id}/resourceGroups/res7231/providers/Microsoft.Network/privateEndpoints/petest01", - } - privateLinkServiceConnectionState: - { description: Auto-Approved, actionRequired: None, status: Approved } - provisioningState: Succeeded - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Update the state of specified private endpoint connection - associated with the storage account., name: Put } - java: { description: Update the state of specified private endpoint connection - associated with the storage account., name: put } - operationGroup: *id264 - operationId: PrivateEndpointConnections_Put - parameters: - - *id030 - - &id275 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id273 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id276 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id273 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id277 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - java: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - nullable: false - operation: *id273 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id274 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id275 - - *id276 - - *id035 - - *id031 - - *id277 - - &id278 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: The private endpoint connection properties., name: properties } - java: - { description: The private endpoint connection properties., name: properties } - nullable: false - operation: *id273 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id268 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id273 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName} - uri: "{$host}" - signatureParameters: - - *id275 - - *id276 - - *id277 - - *id278 - responses: - - language: - default: { description: OK -- Update the private endpoint connection properties - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id268 - signatureParameters: - - *id275 - - *id276 - - *id277 - - &id279 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountDeletePrivateEndpointConnection: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - monitor: "true", - privateEndpointConnectionName: "{privateEndpointConnectionName}", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountDeletePrivateEndpointConnection.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes the specified private endpoint connection associated - with the storage account., name: Delete } - java: { description: Deletes the specified private endpoint connection associated - with the storage account., name: delete } - operationGroup: *id264 - operationId: PrivateEndpointConnections_Delete - parameters: - - *id030 - - &id280 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id279 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id281 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id279 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id282 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - java: { description: The name of the private endpoint connection associated - with the Azure resource, name: privateEndpointConnectionName, serializedName: privateEndpointConnectionName } - nullable: false - operation: *id279 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id274 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id280 - - *id281 - - *id035 - - *id031 - - *id282 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id279 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", - uri: "{$host}", - } - signatureParameters: - - *id280 - - *id281 - - *id282 - responses: - - language: - default: - { - description: OK -- Delete the private endpoint connection successfully., - name: "", - } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content -- The private endpoint connection does - not exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id280 - - *id281 - - *id282 - protocol: {} - - &id283 - $key: PrivateLinkResources - codeModel: *id001 - language: - default: { description: "", name: PrivateLinkResources } - java: { description: "", name: PrivateLinkResources } - operations: - - &id284 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountListPrivateLinkResources: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListPrivateLinkResources.json - responses: - "200": - body: - value: - - name: blob - type: Microsoft.Storage/storageAccounts/privateLinkResources - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/privateLinkResources/blob - properties: - groupId: blob - requiredMembers: [blob] - requiredZoneNames: [privatelink.blob.core.windows.net] - - name: blob_secondary - type: Microsoft.Storage/storageAccounts/privateLinkResources - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/privateLinkResources/blob_secondary - properties: - groupId: blob_secondary - requiredMembers: [blob_secondary] - requiredZoneNames: [privatelink.blob.core.windows.net] - - name: table - type: Microsoft.Storage/storageAccounts/privateLinkResources - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/privateLinkResources/table - properties: - groupId: table - requiredMembers: [table] - requiredZoneNames: [privatelink.table.core.windows.net] - - name: table_secondary - type: Microsoft.Storage/storageAccounts/privateLinkResources - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/privateLinkResources/table_secondary - properties: - groupId: table_secondary - requiredMembers: [table_secondary] - requiredZoneNames: [privatelink.table.core.windows.net] - - name: dfs - type: Microsoft.Storage/storageAccounts/privateLinkResources - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/privateLinkResources/dfs - properties: - groupId: dfs - requiredMembers: [dfs] - requiredZoneNames: [privatelink.dfs.core.windows.net] - - name: dfs_secondary - type: Microsoft.Storage/storageAccounts/privateLinkResources - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/privateLinkResources/dfs_secondary - properties: - groupId: dfs_secondary - requiredMembers: [dfs_secondary] - requiredZoneNames: [privatelink.dfs.core.windows.net] - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Gets the private link resources that need to be created - for a storage account., name: ListByStorageAccount } - java: { description: Gets the private link resources that need to be created - for a storage account., name: listByStorageAccount } - operationGroup: *id283 - operationId: PrivateLinkResources_ListByStorageAccount - parameters: - - *id030 - - &id285 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id284 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id286 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id284 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id285 - - *id286 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id284 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/privateLinkResources", - uri: "{$host}", - } - signatureParameters: - - *id285 - - *id286 - responses: - - language: - default: { description: Successfully retrieved private link resources., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id558 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: A list of private link resources, - name: PrivateLinkResourceListResult, - namespace: "", - } - java: - { - description: A list of private link resources, - name: PrivateLinkResourceListResult, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Array of private link resources, name: value } - java: { description: Array of private link resources, name: value } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id377 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id559 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: A private link resource, - name: PrivateLinkResource, - namespace: "", - } - java: { description: A private link resource, name: PrivateLinkResource } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - immediate: - - *id020 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Resource properties., name: properties } - java: { description: Resource properties., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id560 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { - description: Properties of a private link resource., - name: PrivateLinkResourceProperties, - namespace: "", - } - java: - { - description: Properties of a private link resource., - name: PrivateLinkResourceProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The private link resource group id., - name: groupId, - } - java: - { - description: The private link resource group id., - name: groupId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id707 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: The private link resource group id., - name: PrivateLinkResourcePropertiesGroupId, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: groupId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The private link resource required member - names., name: requiredMembers } - java: { description: The private link resource required member - names., name: requiredMembers } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id375 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id708 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: PrivateLinkResourcePropertiesRequiredMembersItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The private link resource required - member names., name: PrivateLinkResourcePropertiesRequiredMembers } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: requiredMembers - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The private link resource Private link - DNS zone name., name: requiredZoneNames } - java: { description: The private link resource Private link DNS - zone name., name: requiredZoneNames } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id376 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id709 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: PrivateLinkResourcePropertiesRequiredZoneNamesItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: The private link resource Private link - DNS zone name., name: PrivateLinkResourcePropertiesRequiredZoneNames } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: requiredZoneNames - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { - description: Array of private link resources, - name: PrivateLinkResourceListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id285 - - *id286 - protocol: {} - - &id287 - $key: ObjectReplicationPolicies - codeModel: *id001 - language: - default: { description: "", name: ObjectReplicationPolicies } - java: { description: "", name: ObjectReplicationPoliciesOperation } - operations: - - &id288 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountListObjectReplicationPolicies: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountListObjectReplicationPolicies.json - responses: - "200": - body: - value: - - name: c6c23999-fd4e-433a-bcf9-1db69d27cd8a - type: Microsoft.Storage/storageAccounts/objectReplicationPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/objectReplicationPolicies/c6c23999-fd4e-433a-bcf9-1db69d27cd8a - properties: { destinationAccount: destAccount1, sourceAccount: sto2527 } - - name: 141d23dc-8958-4b48-b6e6-5a40bf1af116 - type: Microsoft.Storage/storageAccounts/objectReplicationPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res9290/providers/Microsoft.Storage/storageAccounts/sto1590/objectReplicationPolicies/141d23dc-8958-4b48-b6e6-5a40bf1af116 - properties: { destinationAccount: destAccount2, sourceAccount: sto2527 } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: { description: List the object replication policies associated with - the storage account., name: List } - java: { description: List the object replication policies associated with the - storage account., name: list } - operationGroup: *id287 - operationId: ObjectReplicationPolicies_List - parameters: - - *id030 - - &id289 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id288 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id290 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id288 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id289 - - *id290 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id288 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies", - uri: "{$host}", - } - signatureParameters: - - *id289 - - *id290 - responses: - - language: - default: - { description: OK -- List object replication policies successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id561 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: List storage account object replication policies., - name: ObjectReplicationPolicies, - namespace: "", - } - java: - { - description: List storage account object replication policies., - name: ObjectReplicationPolicies, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: The replication policy between two storage accounts., - name: value, - } - java: - { - description: The replication policy between two storage accounts., - name: value, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id380 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id295 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The replication policy between two storage - accounts. Multiple rules can be defined in one policy., name: ObjectReplicationPolicy, namespace: "" } - java: { description: The replication policy between two storage accounts. - Multiple rules can be defined in one policy., name: ObjectReplicationPolicy } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - immediate: - - *id020 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: Returns the Storage Account Object Replication - Policy., name: properties } - java: { description: Returns the Storage Account Object Replication - Policy., name: properties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id562 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: { description: The Storage Account ObjectReplicationPolicy - properties., name: ObjectReplicationPolicyProperties, namespace: "" } - java: { description: The Storage Account ObjectReplicationPolicy - properties., name: ObjectReplicationPolicyProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: A unique id for object replication policy., - name: policyId, - } - java: - { - description: A unique id for object replication policy., - name: policyId, - } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id710 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: A unique id for object replication - policy., name: ObjectReplicationPolicyPropertiesPolicyId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: policyId - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Indicates when the policy is enabled - on the source account., name: enabledTime } - java: { description: Indicates when the policy is enabled on - the source account., name: enabledTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id467 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Indicates when the policy is enabled - on the source account., name: ObjectReplicationPolicyPropertiesEnabledTime } - protocol: {} - type: DATE_TIME - serializedName: enabledTime - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Required. Source account name., - name: sourceAccount, - } - java: - { - description: Required. Source account name., - name: sourceAccount, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id711 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Required. Source account name., - name: ObjectReplicationPolicyPropertiesSourceAccount, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: sourceAccount - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Required. Destination account name., - name: destinationAccount, - } - java: - { - description: Required. Destination account name., - name: destinationAccount, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id712 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Required. Destination account name., - name: ObjectReplicationPolicyPropertiesDestinationAccount, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: destinationAccount - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The storage account object replication - rules., name: rules } - java: - { - description: The storage account object replication rules., - name: rules, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id379 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id563 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The replication policy rule between - two containers., name: ObjectReplicationPolicyRule, namespace: "" } - java: { description: The replication policy rule between - two containers., name: ObjectReplicationPolicyRule } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Rule Id is auto-generated for each - new rule on destination account. It is required for - put policy on source account., name: ruleId } - java: { description: Rule Id is auto-generated for each - new rule on destination account. It is required for - put policy on source account., name: ruleId } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id713 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Rule Id is auto-generated for - each new rule on destination account. It is required - for put policy on source account., name: ObjectReplicationPolicyRuleId } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: ruleId - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Required. Source container name., - name: sourceContainer, - } - java: - { - description: Required. Source container name., - name: sourceContainer, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id714 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: Required. Source container name., - name: ObjectReplicationPolicyRuleSourceContainer, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: sourceContainer - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required. Destination container - name., name: destinationContainer } - java: - { - description: Required. Destination container name., - name: destinationContainer, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id715 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Required. Destination container - name., name: ObjectReplicationPolicyRuleDestinationContainer } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: destinationContainer - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Optional. An object that defines - the filter set., name: filters } - java: { description: Optional. An object that defines the - filter set., name: filters } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id564 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "Filters limit replication to - a subset of blobs within the storage account. A - logical OR is performed on values in the filter. - If multiple filters are defined, a logical AND is - performed on all filters.", name: ObjectReplicationPolicyFilter, namespace: "" } - java: { description: "Filters limit replication to a - subset of blobs within the storage account. A logical - OR is performed on values in the filter. If multiple - filters are defined, a logical AND is performed - on all filters.", name: ObjectReplicationPolicyFilter } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Optional. Filters the results - to replicate only blobs whose names begin with - the specified prefix., name: prefixMatch } - java: { description: Optional. Filters the results - to replicate only blobs whose names begin with - the specified prefix., name: prefixMatch } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id378 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id716 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: ObjectReplicationPolicyFilterPrefixMatchItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: Optional. Filters the results - to replicate only blobs whose names begin with - the specified prefix., name: ObjectReplicationPolicyFilterPrefixMatch } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: prefixMatch - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Blobs created after the time - will be replicated to the destination. It must - be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. - Example: 2020-02-19T16:05:00Z", name: minCreationTime } - java: { description: "Blobs created after the time - will be replicated to the destination. It must - be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. - Example: 2020-02-19T16:05:00Z", name: minCreationTime } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id717 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "Blobs created after the - time will be replicated to the destination. - It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. - Example: 2020-02-19T16:05:00Z", name: ObjectReplicationPolicyFilterMinCreationTime } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: minCreationTime - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: filters - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: { description: The storage account object replication - rules., name: ObjectReplicationPolicyPropertiesRules } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: rules - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: - { - description: The replication policy between two storage accounts., - name: ObjectReplicationPoliciesValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id289 - - *id290 - - &id291 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountGetObjectReplicationPolicies: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - monitor: "true", - objectReplicationPolicyId: "{objectReplicationPolicy-Id}", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountGetObjectReplicationPolicy.json - responses: - "200": - body: - name: "{objectReplicationPolicy-Id}" - type: Microsoft.Storage/storageAccounts/objectReplicationPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res6977/providers/Microsoft.Storage/storageAccounts/sto2527/objectReplicationPolicies/{objectReplicationPolicy-Id} - properties: - destinationAccount: destAccount1 - enabledTime: "2019-06-08T03:01:55.7168089Z" - policyId: "{objectReplicationPolicy-Id}" - rules: - - destinationContainer: destContainer1 - filters: - prefixMatch: [blobA, blobB] - sourceContainer: sourceContainer1 - - destinationContainer: destContainer1 - filters: - prefixMatch: [blobC, blobD] - sourceContainer: sourceContainer1 - sourceAccount: sto2527 - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Get the object replication policy of the storage account - by policy ID., name: Get } - java: { description: Get the object replication policy of the storage account - by policy ID., name: get } - operationGroup: *id287 - operationId: ObjectReplicationPolicies_Get - parameters: - - *id030 - - &id292 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id291 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id293 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id291 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id294 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The ID of object replication policy or 'default' if - the policy ID is unknown., name: objectReplicationPolicyId, serializedName: objectReplicationPolicyId } - java: { description: The ID of object replication policy or 'default' if the - policy ID is unknown., name: objectReplicationPolicyId, serializedName: objectReplicationPolicyId } - nullable: false - operation: *id291 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id297 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "", name: String } - maxLength: 0.0 - minLength: 1.0 - protocol: {} - type: STRING - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id292 - - *id293 - - *id035 - - *id031 - - *id294 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id291 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}", - uri: "{$host}", - } - signatureParameters: - - *id292 - - *id293 - - *id294 - responses: - - language: - default: - { description: OK -- Get the object replication policy successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id295 - signatureParameters: - - *id292 - - *id293 - - *id294 - - &id296 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountCreateObjectReplicationPolicyOnSource: - parameters: - accountName: src1122 - api-version: 2020-08-01-preview - monitor: "true" - objectReplicationPolicyId: 2a20bb73-5717-4635-985a-5d4cf777438f - properties: - properties: - destinationAccount: dst112 - rules: - - destinationContainer: dcont139 - filters: - minCreationTime: "2020-02-19T16:05:00Z" - prefixMatch: [blobA, blobB] - ruleId: d5d18a48-8801-4554-aeaa-74faf65f5ef9 - sourceContainer: scont139 - sourceAccount: src1122 - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountCreateObjectReplicationPolicyOnSource.json - responses: - "200": - body: - name: 2a20bb73-5717-4635-985a-5d4cf777438f - type: Microsoft.Storage/storageAccounts/objectReplicationPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f - properties: - destinationAccount: dst112 - enabledTime: "2019-06-08T03:01:55.7168089Z" - policyId: 2a20bb73-5717-4635-985a-5d4cf777438f - rules: - - destinationContainer: destContainer1 - filters: - minCreationTime: "2020-02-19T16:05:00Z" - prefixMatch: [blobA, blobB] - ruleId: d5d18a48-8801-4554-aeaa-74faf65f5ef9 - sourceContainer: sourceContainer1 - sourceAccount: src1122 - StorageAccountUpdateObjectReplicationPolicyOnDestination: - parameters: - accountName: dst112 - api-version: 2020-08-01-preview - monitor: "true" - objectReplicationPolicyId: 2a20bb73-5717-4635-985a-5d4cf777438f - properties: - properties: - destinationAccount: dst112 - rules: - - destinationContainer: dcont139 - filters: - prefixMatch: [blobA, blobB] - ruleId: d5d18a48-8801-4554-aeaa-74faf65f5ef9 - sourceContainer: scont139 - - { destinationContainer: dcont179, sourceContainer: scont179 } - sourceAccount: src1122 - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountUpdateObjectReplicationPolicyOnDestination.json - responses: - "200": - body: - name: 2a20bb73-5717-4635-985a-5d4cf777438f - type: Microsoft.Storage/storageAccounts/objectReplicationPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f - properties: - destinationAccount: dst112 - policyId: 2a20bb73-5717-4635-985a-5d4cf777438f - rules: - - destinationContainer: destContainer1 - filters: - prefixMatch: [blobA, blobB] - ruleId: d5d18a48-8801-4554-aeaa-74faf65f5ef9 - sourceContainer: sourceContainer1 - - { - destinationContainer: dcont179, - ruleId: cfbb4bc2-8b60-429f-b05a-d1e0942b33b2, - sourceContainer: scont179, - } - sourceAccount: src1122 - StorageAccountCreateObjectReplicationPolicyOnDestination: - parameters: - accountName: dst112 - api-version: 2020-08-01-preview - monitor: "true" - objectReplicationPolicyId: default - properties: - properties: - destinationAccount: dst112 - rules: - - destinationContainer: dcont139 - filters: - prefixMatch: [blobA, blobB] - sourceContainer: scont139 - sourceAccount: src1122 - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountCreateObjectReplicationPolicyOnDestination.json - responses: - "200": - body: - name: 2a20bb73-5717-4635-985a-5d4cf777438f - type: Microsoft.Storage/storageAccounts/objectReplicationPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/dst112/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f - properties: - destinationAccount: dst112 - policyId: 2a20bb73-5717-4635-985a-5d4cf777438f - rules: - - destinationContainer: destContainer1 - filters: - prefixMatch: [blobA, blobB] - ruleId: d5d18a48-8801-4554-aeaa-74faf65f5ef9 - sourceContainer: sourceContainer1 - sourceAccount: src1122 - StorageAccountUpdateObjectReplicationPolicyOnSource: - parameters: - accountName: src1122 - api-version: 2020-08-01-preview - monitor: "true" - objectReplicationPolicyId: 2a20bb73-5717-4635-985a-5d4cf777438f - properties: - properties: - destinationAccount: dst112 - rules: - - destinationContainer: dcont139 - filters: - prefixMatch: [blobA, blobB] - ruleId: d5d18a48-8801-4554-aeaa-74faf65f5ef9 - sourceContainer: scont139 - - { - destinationContainer: dcont179, - ruleId: cfbb4bc2-8b60-429f-b05a-d1e0942b33b2, - sourceContainer: scont179, - } - sourceAccount: src1122 - resourceGroupName: res7687 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountUpdateObjectReplicationPolicyOnSource.json - responses: - "200": - body: - name: 2a20bb73-5717-4635-985a-5d4cf777438f - type: Microsoft.Storage/storageAccounts/objectReplicationPolicies - id: /subscriptions/{subscription-id}/resourceGroups/res7687/providers/Microsoft.Storage/storageAccounts/src1122/objectReplicationPolicies/2a20bb73-5717-4635-985a-5d4cf777438f - properties: - destinationAccount: dst112 - enabledTime: "2019-06-08T03:01:55.7168089Z" - policyId: 2a20bb73-5717-4635-985a-5d4cf777438f - rules: - - destinationContainer: destContainer1 - filters: - prefixMatch: [blobA, blobB] - ruleId: d5d18a48-8801-4554-aeaa-74faf65f5ef9 - sourceContainer: sourceContainer1 - - { - destinationContainer: dcont179, - ruleId: cfbb4bc2-8b60-429f-b05a-d1e0942b33b2, - sourceContainer: scont179, - } - sourceAccount: src1122 - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Create or update the object replication policy of the - storage account., name: CreateOrUpdate } - java: { description: Create or update the object replication policy of the storage - account., name: createOrUpdate } - operationGroup: *id287 - operationId: ObjectReplicationPolicies_CreateOrUpdate - parameters: - - *id030 - - &id298 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id296 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id299 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id296 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id300 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The ID of object replication policy or 'default' if - the policy ID is unknown., name: objectReplicationPolicyId, serializedName: objectReplicationPolicyId } - java: { description: The ID of object replication policy or 'default' if the - policy ID is unknown., name: objectReplicationPolicyId, serializedName: objectReplicationPolicyId } - nullable: false - operation: *id296 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id297 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id298 - - *id299 - - *id035 - - *id031 - - *id300 - - &id301 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The object replication policy set to a storage account. - A unique policy ID will be created if absent., name: properties } - java: { description: The object replication policy set to a storage account. - A unique policy ID will be created if absent., name: properties } - nullable: false - operation: *id296 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id295 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id296 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId} - uri: "{$host}" - signatureParameters: - - *id298 - - *id299 - - *id300 - - *id301 - responses: - - language: - default: { description: OK -- Put object replication policy successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id295 - signatureParameters: - - *id298 - - *id299 - - *id300 - - &id302 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountDeleteObjectReplicationPolicies: - parameters: - { - accountName: sto2527, - api-version: 2020-08-01-preview, - monitor: "true", - objectReplicationPolicyId: "{objectReplicationPolicy-Id}", - resourceGroupName: res6977, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountDeleteObjectReplicationPolicy.json - responses: - "200": {} - "204": {} - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Deletes the object replication policy associated with - the specified storage account., name: Delete } - java: { description: Deletes the object replication policy associated with the - specified storage account., name: delete } - operationGroup: *id287 - operationId: ObjectReplicationPolicies_Delete - parameters: - - *id030 - - &id303 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id302 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id304 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id302 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id305 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The ID of object replication policy or 'default' if - the policy ID is unknown., name: objectReplicationPolicyId, serializedName: objectReplicationPolicyId } - java: { description: The ID of object replication policy or 'default' if the - policy ID is unknown., name: objectReplicationPolicyId, serializedName: objectReplicationPolicyId } - nullable: false - operation: *id302 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id297 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id303 - - *id304 - - *id035 - - *id031 - - *id305 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id302 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: delete, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}", - uri: "{$host}", - } - signatureParameters: - - *id303 - - *id304 - - *id305 - responses: - - language: - default: - { description: OK -- Delete the object replication policy successfully., name: "" } - protocol: - http: - explode: false - statusCodes: ["200"] - - language: - default: { description: No Content -- The object replication policy does not - exist., name: "" } - protocol: - http: - explode: false - statusCodes: ["204"] - signatureParameters: - - *id303 - - *id304 - - *id305 - protocol: {} - - &id306 - $key: EncryptionScopes - codeModel: *id001 - language: - default: { description: "", name: EncryptionScopes } - java: { description: "", name: EncryptionScopes } - operations: - - &id307 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountPutEncryptionScopeWithInfrastructureEncryption: - parameters: - accountName: "{storage-account-name}" - api-version: "2021-01-01" - encryptionScope: - properties: { requireInfrastructureEncryption: true } - encryptionScopeName: "{encryption-scope-name}" - monitor: "true" - resourceGroupName: resource-group-name - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountPutEncryptionScopeWithInfrastructureEncryption.json - responses: - "200": - body: - name: "{encryption-scope-name}" - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name} - properties: - { - creationTime: "2018-10-16T02:42:41.7633306Z", - lastModifiedTime: "2018-10-16T02:42:41.7633306Z", - requireInfrastructureEncryption: true, - source: Microsoft.Storage, - state: Enabled, - } - "201": - body: - name: "{encryption-scope-name}" - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name} - properties: - { - creationTime: "2018-10-16T02:42:41.7633306Z", - lastModifiedTime: "2018-10-16T02:42:41.7633306Z", - requireInfrastructureEncryption: true, - source: Microsoft.Storage, - state: Enabled, - } - StorageAccountPutEncryptionScope: - parameters: - accountName: "{storage-account-name}" - api-version: 2020-08-01-preview - encryptionScope: {} - encryptionScopeName: "{encryption-scope-name}" - monitor: "true" - resourceGroupName: resource-group-name - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountPutEncryptionScope.json - responses: - "200": - body: - name: "{encryption-scope-name}" - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name} - properties: - { - creationTime: "2018-10-16T02:42:41.7633306Z", - lastModifiedTime: "2018-10-16T02:42:41.7633306Z", - source: Microsoft.Storage, - state: Enabled, - } - "201": - body: - name: "{encryption-scope-name}" - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name} - properties: - { - creationTime: "2018-10-16T02:42:41.7633306Z", - lastModifiedTime: "2018-10-16T02:42:41.7633306Z", - source: Microsoft.Storage, - state: Enabled, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Synchronously creates or updates an encryption scope - under the specified storage account. If an encryption scope is already created - and a subsequent request is issued with different properties, the encryption - scope properties will be updated per the specified request.", name: Put } - java: { description: "Synchronously creates or updates an encryption scope under - the specified storage account. If an encryption scope is already created - and a subsequent request is issued with different properties, the encryption - scope properties will be updated per the specified request.", name: put } - operationGroup: *id306 - operationId: EncryptionScopes_Put - parameters: - - *id030 - - &id308 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id307 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id309 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id307 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id310 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the encryption scope within the specified - storage account. Encryption scope names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a letter - or number.", name: encryptionScopeName, serializedName: encryptionScopeName } - java: { description: "The name of the encryption scope within the specified - storage account. Encryption scope names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a letter - or number.", name: encryptionScopeName, serializedName: encryptionScopeName } - nullable: false - operation: *id307 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id308 - - *id309 - - *id035 - - *id031 - - *id310 - - &id311 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Encryption scope properties to be used for the create - or update., name: encryptionScope } - java: { description: Encryption scope properties to be used for the create - or update., name: encryptionScope } - nullable: false - operation: *id307 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id312 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The Encryption Scope resource., - name: EncryptionScope, - namespace: "", - } - java: { description: The Encryption Scope resource., name: EncryptionScope } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - immediate: - - *id020 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: - { - description: Properties of the encryption scope., - name: encryptionScopeProperties, - } - java: - { - description: Properties of the encryption scope., - name: encryptionScopeProperties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id565 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: true - language: - default: - { - description: Properties of the encryption scope., - name: EncryptionScopeProperties, - namespace: "", - } - java: - { - description: Properties of the encryption scope., - name: EncryptionScopeProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "The provider for the encryption scope. Possible - values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault.", name: source } - java: { description: "The provider for the encryption scope. Possible - values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault.", name: source } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id438 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: MICROSOFT_STORAGE } - value: Microsoft.Storage - - language: - default: { description: "", name: MICROSOFT_KEY_VAULT } - value: Microsoft.KeyVault - language: - default: { description: "The provider for the encryption scope. - Possible values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault.", name: EncryptionScopeSource } - java: - { description: "The provider for the encryption scope. Possible - values (case-insensitive): Microsoft.Storage, Microsoft.KeyVault.", name: EncryptionScopeSource } - protocol: {} - type: CHOICE - serializedName: source - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The state of the encryption scope. Possible - values (case-insensitive): Enabled, Disabled.", name: state } - java: { description: "The state of the encryption scope. Possible - values (case-insensitive): Enabled, Disabled.", name: state } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id439 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: ENABLED } - value: Enabled - - language: - default: { description: "", name: DISABLED } - value: Disabled - language: - default: { description: "The state of the encryption scope. Possible - values (case-insensitive): Enabled, Disabled.", name: EncryptionScopeState } - java: { description: "The state of the encryption scope. Possible - values (case-insensitive): Enabled, Disabled.", name: EncryptionScopeState } - protocol: {} - type: CHOICE - serializedName: state - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Gets the creation date and time of the encryption - scope in UTC., name: creationTime } - java: { description: Gets the creation date and time of the encryption - scope in UTC., name: creationTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id468 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Gets the creation date and time of the - encryption scope in UTC., name: EncryptionScopePropertiesCreationTime } - protocol: {} - type: DATE_TIME - serializedName: creationTime - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Gets the last modification date and time - of the encryption scope in UTC., name: lastModifiedTime } - java: { description: Gets the last modification date and time of - the encryption scope in UTC., name: lastModifiedTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id469 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Gets the last modification date and time - of the encryption scope in UTC., name: EncryptionScopePropertiesLastModifiedTime } - protocol: {} - type: DATE_TIME - serializedName: lastModifiedTime - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The key vault properties for the encryption - scope. This is a required field if encryption scope 'source' - attribute is set to 'Microsoft.KeyVault'., name: keyVaultProperties } - java: { description: The key vault properties for the encryption - scope. This is a required field if encryption scope 'source' - attribute is set to 'Microsoft.KeyVault'., name: keyVaultProperties } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id566 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The key vault properties for the encryption - scope. This is a required field if encryption scope 'source' - attribute is set to 'Microsoft.KeyVault'., name: EncryptionScopeKeyVaultProperties, namespace: "" } - java: { description: The key vault properties for the encryption - scope. This is a required field if encryption scope 'source' - attribute is set to 'Microsoft.KeyVault'., name: EncryptionScopeKeyVaultProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The object identifier for a key vault - key object. When applied, the encryption scope will use - the key referenced by the identifier to enable customer-managed - key support on this encryption scope.", name: keyUri } - java: { description: "The object identifier for a key vault key - object. When applied, the encryption scope will use the - key referenced by the identifier to enable customer-managed - key support on this encryption scope.", name: keyUri } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id718 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: "The object identifier for a key vault - key object. When applied, the encryption scope will use - the key referenced by the identifier to enable customer-managed - key support on this encryption scope.", name: EncryptionScopeKeyVaultPropertiesKeyUri } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: keyUri - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The object identifier of the current - versioned Key Vault Key in use., name: currentVersionedKeyIdentifier } - java: - { description: The object identifier of the current versioned - Key Vault Key in use., name: currentVersionedKeyIdentifier } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id719 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: The object identifier of the current - versioned Key Vault Key in use., name: EncryptionScopeKeyVaultPropertiesCurrentVersionedKeyIdentifier } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: currentVersionedKeyIdentifier - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Timestamp of last rotation of the Key - Vault Key., name: lastKeyRotationTimestamp } - java: { description: Timestamp of last rotation of the Key Vault - Key., name: lastKeyRotationTimestamp } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id470 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Timestamp of last rotation of the Key - Vault Key., name: EncryptionScopeKeyVaultPropertiesLastKeyRotationTimestamp } - protocol: {} - type: DATE_TIME - serializedName: lastKeyRotationTimestamp - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: keyVaultProperties - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed - keys for data at rest., name: requireInfrastructureEncryption } - java: { description: A boolean indicating whether or not the service - applies a secondary layer of encryption with platform managed - keys for data at rest., name: requireInfrastructureEncryption } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id409 - apiVersions: [] - language: - default: { description: A boolean indicating whether or not the - service applies a secondary layer of encryption with platform - managed keys for data at rest., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: requireInfrastructureEncryption - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id307 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName} - uri: "{$host}" - signatureParameters: - - *id308 - - *id309 - - *id310 - - *id311 - responses: - - language: - default: - { - description: OK -- Update encryption scope operation completed successfully., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id312 - - language: - default: { description: Created -- Create encryption scope operation completed - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["201"] - schema: *id312 - signatureParameters: - - *id308 - - *id309 - - *id310 - - &id313 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountPatchEncryptionScope: - parameters: - accountName: "{storage-account-name}" - api-version: 2020-08-01-preview - encryptionScope: - properties: - keyVaultProperties: - { - keyUri: "https://testvault.vault.core.windows.net/keys/key1/863425f1358359c", - } - source: Microsoft.KeyVault - encryptionScopeName: "{encryption-scope-name}" - monitor: "true" - resourceGroupName: resource-group-name - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountPatchEncryptionScope.json - responses: - "200": - body: - name: "{encryption-scope-name}" - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name} - properties: - creationTime: "2018-10-16T02:42:41.7633306Z" - keyVaultProperties: - { - currentVersionedKeyIdentifier: "https://testvault.vault.core.windows.net/keys/key1/863425f1358359c", - keyUri: "https://testvault.vault.core.windows.net/keys/key1/863425f1358359c", - lastKeyRotationTimestamp: "2019-12-13T20:36:23.7023290Z", - } - lastModifiedTime: "2018-10-17T06:23:14.4513306Z" - source: Microsoft.KeyVault - state: Enabled - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: Update encryption scope properties as specified in the - request body. Update fails if the specified encryption scope does not already - exist., name: Patch } - java: { description: Update encryption scope properties as specified in the request - body. Update fails if the specified encryption scope does not already exist., name: patch } - operationGroup: *id306 - operationId: EncryptionScopes_Patch - parameters: - - *id030 - - &id314 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id313 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id315 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id313 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id316 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the encryption scope within the specified - storage account. Encryption scope names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a letter - or number.", name: encryptionScopeName, serializedName: encryptionScopeName } - java: { description: "The name of the encryption scope within the specified - storage account. Encryption scope names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a letter - or number.", name: encryptionScopeName, serializedName: encryptionScopeName } - nullable: false - operation: *id313 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id314 - - *id315 - - *id035 - - *id031 - - *id316 - - &id317 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { - description: Encryption scope properties to be used for the update., - name: encryptionScope, - } - java: - { - description: Encryption scope properties to be used for the update., - name: encryptionScope, - } - nullable: false - operation: *id313 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id312 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id313 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: patch - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName} - uri: "{$host}" - signatureParameters: - - *id314 - - *id315 - - *id316 - - *id317 - responses: - - language: - default: - { - description: OK -- Update encryption scope operation completed successfully., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id312 - signatureParameters: - - *id314 - - *id315 - - *id316 - - &id318 - apiVersions: - - { version: "2021-01-01" } - exceptions: - - language: - default: - { description: Error response describing why the operation failed., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: [default] - schema: *id219 - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountGetEncryptionScope: - parameters: - { - accountName: "{storage-account-name}", - api-version: 2020-08-01-preview, - encryptionScopeName: "{encryption-scope-name}", - monitor: "true", - resourceGroupName: resource-group-name, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountGetEncryptionScope.json - responses: - "200": - body: - name: "{encyrption-scope-name}" - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/{encryption-scope-name} - properties: - { - creationTime: "2018-10-16T02:42:41.7633306Z", - lastModifiedTime: "2018-10-16T02:42:41.7633306Z", - source: Microsoft.Storage, - state: Enabled, - } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: - { description: Returns the properties for the specified encryption scope., name: Get } - java: - { description: Returns the properties for the specified encryption scope., name: get } - operationGroup: *id306 - operationId: EncryptionScopes_Get - parameters: - - *id030 - - &id319 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id318 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id320 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id318 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id321 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The name of the encryption scope within the specified - storage account. Encryption scope names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a letter - or number.", name: encryptionScopeName, serializedName: encryptionScopeName } - java: { description: "The name of the encryption scope within the specified - storage account. Encryption scope names must be between 3 and 63 characters - in length and use numbers, lower-case letters and dash (-) only. Every - dash (-) character must be immediately preceded and followed by a letter - or number.", name: encryptionScopeName, serializedName: encryptionScopeName } - nullable: false - operation: *id318 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id050 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id319 - - *id320 - - *id035 - - *id031 - - *id321 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id318 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes/{encryptionScopeName}", - uri: "{$host}", - } - signatureParameters: - - *id319 - - *id320 - - *id321 - responses: - - language: - default: - { - description: OK -- Get encryption scope operation completed successfully., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id312 - signatureParameters: - - *id319 - - *id320 - - *id321 - - &id327 - apiVersions: &id322 - - { version: "2021-01-01" } - exceptions: &id323 [] - extensions: &id324 - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - StorageAccountEncryptionScopeList: - parameters: - { - accountName: "{storage-account-name}", - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: resource-group-name, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/StorageAccountEncryptionScopeList.json - responses: - "200": - body: - nextLink: null - value: - - name: scope-1 - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/scope-1 - properties: - { - creationTime: "2018-10-16T02:42:41.7633306Z", - lastModifiedTime: "2018-10-16T02:42:41.7633306Z", - source: Microsoft.Storage, - state: Enabled, - } - - name: scope-2 - type: Microsoft.Storage/storageAccounts/encryptionScopes - id: /subscriptions/{subscription-id}/resourceGroups/resource-group-name/providers/Microsoft.Storage/storageAccounts/{storage-account-name}/encryptionScopes/scope-2 - properties: - creationTime: "2018-10-16T04:32:14.3355306Z" - keyVaultProperties: - { - keyUri: "https://testvault.vault.core.windows.net/keys/key1/863425f1358359c", - } - lastModifiedTime: "2018-10-17T06:23:14.4513306Z" - source: Microsoft.KeyVault - state: Enabled - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: - itemName: value - nextLinkName: nextLink - nextOperation: &id326 - $key: listNext - apiVersions: *id322 - exceptions: *id323 - extensions: *id324 - language: - java: { description: Get the next page of items, name: listNext } - operationGroup: *id306 - parameters: [] - requests: - - language: &id329 - default: { description: Lists all the encryption scopes available under - the specified storage account., name: List } - java: { description: Lists all the encryption scopes available under - the specified storage account., name: list } - parameters: - - &id328 - $key: nextLink - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: false, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: true, - } - flattened: false - implementation: METHOD - language: - default: &id325 { name: nextLink, serializedName: nextLink } - java: *id325 - nullable: false - operation: *id326 - protocol: - http: { explode: false, in: PATH } - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema - apiVersions: [] - maxLength: 0.0 - minLength: 0.0 - summary: The URL to get the next list of items - - *id030 - - &id332 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: - { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id327 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: { explode: false, method: get, path: "{nextLink}", uri: "{$host}" } - signatureParameters: - - *id328 - responses: &id333 - - language: - default: { description: OK -- List encryption scopes operation completed - successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id567 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "List of encryption scopes requested, and if - paging is required, a URL to the next page of encryption scopes.", name: EncryptionScopeListResult, namespace: "" } - java: { description: "List of encryption scopes requested, and if paging - is required, a URL to the next page of encryption scopes.", name: EncryptionScopeListResult } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: List of encryption scopes requested., name: value } - java: { description: List of encryption scopes requested., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id381 - apiVersions: - - { version: "2021-01-01" } - elementType: *id312 - language: - default: - { - description: List of encryption scopes requested., - name: EncryptionScopeListResultValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Request URL that can be used to query next - page of encryption scopes. Returned when total number of requested - encryption scopes exceeds the maximum page size., name: nextLink } - java: { description: Request URL that can be used to query next page - of encryption scopes. Returned when total number of requested - encryption scopes exceeds the maximum page size., name: nextLink } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id720 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: Request URL that can be used to query next - page of encryption scopes. Returned when total number of requested - encryption scopes exceeds the maximum page size., name: EncryptionScopeListResultNextLink } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: nextLink - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: [] - xmsSkipUrlEncoding: false - language: *id329 - operationGroup: *id306 - operationId: EncryptionScopes_List - parameters: - - *id030 - - &id330 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id327 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id331 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id327 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id330 - - *id331 - - *id035 - - *id031 - - *id332 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/encryptionScopes", - uri: "{$host}", - } - signatureParameters: - - *id330 - - *id331 - responses: *id333 - signatureParameters: - - *id330 - - *id331 - - *id326 - protocol: {} - - &id334 - $key: BlobServices - codeModel: *id001 - language: - default: { description: "", name: BlobServices } - java: { description: "", name: BlobServices } - operations: - - &id335 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - ListBlobServices: - parameters: - { - accountName: sto8607, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res4410, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobServicesList.json - responses: - "200": - body: - value: - - name: default - type: Microsoft.Storage/storageAccounts/blobServices - id: /subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default - properties: - changeFeed: { enabled: true, retentionInDays: 7 } - cors: - corsRules: - - allowedHeaders: - [x-ms-meta-abc, x-ms-meta-data*, x-ms-meta-target*] - allowedMethods: [GET, HEAD, POST, OPTIONS, MERGE, PUT] - allowedOrigins: - ["http://www.contoso.com", "http://www.fabrikam.com"] - exposedHeaders: [x-ms-meta-*] - maxAgeInSeconds: 100 - - allowedHeaders: ["*"] - allowedMethods: [GET] - allowedOrigins: ["*"] - exposedHeaders: ["*"] - maxAgeInSeconds: 2 - - allowedHeaders: [x-ms-meta-12345675754564*] - allowedMethods: [GET, PUT] - allowedOrigins: - ["http://www.abc23.com", "https://www.fabrikam.com/*"] - exposedHeaders: - [x-ms-meta-abc, x-ms-meta-data*, x -ms-meta-target*] - maxAgeInSeconds: 2000 - defaultServiceVersion: "2017-07-29" - deleteRetentionPolicy: { days: 300, enabled: true } - isVersioningEnabled: true - sku: { name: Standard_GRS, tier: Standard } - xmsFlattened: false - xmsLongRunningOperation: false - xmsPageable: { itemName: value } - xmsSkipUrlEncoding: false - language: - default: { description: List blob services of storage account. It returns a collection - of one object named default., name: List } - java: { description: List blob services of storage account. It returns a collection - of one object named default., name: list } - operationGroup: *id334 - operationId: BlobServices_List - parameters: - - *id030 - - &id336 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id335 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id337 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id335 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id336 - - *id337 - - *id035 - - *id031 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id335 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices", - uri: "{$host}", - } - signatureParameters: - - *id336 - - *id337 - responses: - - language: - default: - { - description: OK -- List blob services operation completed successfully., - name: "", - } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id568 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "", name: BlobServiceItems, namespace: "" } - java: { description: "", name: BlobServiceItems } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: List of blob services returned., name: value } - java: { description: List of blob services returned., name: value } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id388 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id343 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The properties of a storage account’s Blob - service., name: BlobServiceProperties, namespace: "" } - java: - { - description: The properties of a storage account’s Blob service., - name: BlobServiceProperties, - } - maxProperties: 0.0 - minProperties: 0.0 - parents: - all: - - *id020 - immediate: - - *id020 - properties: - - apiVersions: [] - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - isDiscriminator: false - language: - default: { description: The properties of a storage account’s Blob - service., name: blobServiceProperties } - java: - { - description: The properties of a storage account’s Blob service., - name: blobServiceProperties, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id569 - apiVersions: - - { version: "2021-01-01" } - extensions: - { - xmsAzureResource: false, - xmsClientFlatten: true, - xmsFlattened: false, - xmsLongRunningOperation: false, - xmsSkipUrlEncoding: false, - } - flattenedSchema: true - language: - default: { description: The properties of a storage account’s Blob - service., name: BlobServicePropertiesProperties, namespace: "" } - java: { description: The properties of a storage account’s Blob - service., name: BlobServicePropertiesProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: "Specifies CORS rules for the Blob service. - You can include up to five CorsRule elements in the request. - If no CorsRule elements are included in the request body, - all CORS rules will be deleted, and CORS will be disabled - for the Blob service.", name: cors } - java: { description: "Specifies CORS rules for the Blob service. - You can include up to five CorsRule elements in the request. - If no CorsRule elements are included in the request body, - all CORS rules will be deleted, and CORS will be disabled - for the Blob service.", name: cors } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id570 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: "Sets the CORS rules. You can include - up to five CorsRule elements in the request. ", name: CorsRules, namespace: "" } - java: { description: "Sets the CORS rules. You can include - up to five CorsRule elements in the request. ", name: CorsRules } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The List of CORS rules. You can - include up to five CorsRule elements in the request. ", name: corsRules } - java: - { description: "The List of CORS rules. You can include - up to five CorsRule elements in the request. ", name: corsRules } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id386 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id571 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: Specifies a CORS rule for the - Blob service., name: CorsRule, namespace: "" } - java: { description: Specifies a CORS rule for the Blob - service., name: CorsRule } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: 'Required if CorsRule element - is present. A list of origin domains that will - be allowed via CORS, or "*" to allow all domains', name: allowedOrigins } - java: { description: 'Required if CorsRule element - is present. A list of origin domains that will - be allowed via CORS, or "*" to allow all domains', name: allowedOrigins } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id382 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id721 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: CorsRuleAllowedOriginsItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: 'Required if CorsRule element - is present. A list of origin domains that will - be allowed via CORS, or "*" to allow all domains', name: CorsRuleAllowedOrigins } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: allowedOrigins - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required if CorsRule element - is present. A list of HTTP methods that are allowed - to be executed by the origin., name: allowedMethods } - java: { description: Required if CorsRule element is - present. A list of HTTP methods that are allowed - to be executed by the origin., name: allowedMethods } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id383 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id440 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: { description: "", name: DELETE } - value: DELETE - - language: - default: { description: "", name: GET } - value: GET - - language: - default: { description: "", name: HEAD } - value: HEAD - - language: - default: { description: "", name: MERGE } - value: MERGE - - language: - default: { description: "", name: POST } - value: POST - - language: - default: { description: "", name: OPTIONS } - value: OPTIONS - - language: - default: { description: "", name: PUT } - value: PUT - language: - default: - { - description: "", - name: CorsRuleAllowedMethodsItem, - } - java: - { - description: "", - name: CorsRuleAllowedMethodsItem, - } - protocol: {} - type: CHOICE - language: - default: - { description: Required if CorsRule element - is present. A list of HTTP methods that are - allowed to be executed by the origin., name: CorsRuleAllowedMethods } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: allowedMethods - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required if CorsRule element - is present. The number of seconds that the client/browser - should cache a preflight response., name: maxAgeInSeconds } - java: { description: Required if CorsRule element is - present. The number of seconds that the client/browser - should cache a preflight response., name: maxAgeInSeconds } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id486 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: Required if CorsRule element - is present. The number of seconds that the client/browser - should cache a preflight response., name: CorsRuleMaxAgeInSeconds } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: maxAgeInSeconds - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required if CorsRule element - is present. A list of response headers to expose - to CORS clients., name: exposedHeaders } - java: { description: Required if CorsRule element is - present. A list of response headers to expose - to CORS clients., name: exposedHeaders } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id384 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id722 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: CorsRuleExposedHeadersItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: Required if CorsRule element - is present. A list of response headers to expose - to CORS clients., name: CorsRuleExposedHeaders } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: exposedHeaders - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Required if CorsRule element - is present. A list of headers allowed to be part - of the cross-origin request., name: allowedHeaders } - java: { description: Required if CorsRule element is - present. A list of headers allowed to be part - of the cross-origin request., name: allowedHeaders } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id385 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id723 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: CorsRuleAllowedHeadersItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: - { description: Required if CorsRule element - is present. A list of headers allowed to be - part of the cross-origin request., name: CorsRuleAllowedHeaders } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: allowedHeaders - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - language: - default: { description: "The List of CORS rules. You can - include up to five CorsRule elements in the request. ", name: CorsRules } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: corsRules - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: cors - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: DefaultServiceVersion indicates the default - version to use for requests to the Blob service if an incoming - request’s version is not specified. Possible values include - version 2008-10-27 and all more recent versions., name: defaultServiceVersion } - java: { description: DefaultServiceVersion indicates the default - version to use for requests to the Blob service if an incoming - request’s version is not specified. Possible values include - version 2008-10-27 and all more recent versions., name: defaultServiceVersion } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id724 - apiVersions: - - { version: "2021-01-01" } - language: - default: { description: DefaultServiceVersion indicates the - default version to use for requests to the Blob service - if an incoming request’s version is not specified. Possible - values include version 2008-10-27 and all more recent - versions., name: BlobServicePropertiesDefaultServiceVersion } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - serializedName: defaultServiceVersion - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The blob service properties for blob - soft delete., name: deleteRetentionPolicy } - java: { description: The blob service properties for blob soft - delete., name: deleteRetentionPolicy } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id338 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: - { - description: The service properties for soft delete., - name: DeleteRetentionPolicy, - namespace: "", - } - java: - { - description: The service properties for soft delete., - name: DeleteRetentionPolicy, - } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Indicates whether DeleteRetentionPolicy - is enabled., name: enabled } - java: { description: Indicates whether DeleteRetentionPolicy - is enabled., name: enabled } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id410 - apiVersions: [] - language: - default: - { description: Indicates whether DeleteRetentionPolicy - is enabled., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Indicates the number of days that - the deleted item should be retained. The minimum specified - value can be 1 and the maximum value can be 365., name: days } - java: { description: Indicates the number of days that the - deleted item should be retained. The minimum specified - value can be 1 and the maximum value can be 365., name: days } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id487 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: Indicates the number of days that - the deleted item should be retained. The minimum specified - value can be 1 and the maximum value can be 365., name: DeleteRetentionPolicyDays } - maximum: 365.0 - minimum: 1.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: days - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: deleteRetentionPolicy - - apiVersions: [] - isDiscriminator: false - language: - default: - { - description: Versioning is enabled if set to true., - name: isVersioningEnabled, - } - java: - { - description: Versioning is enabled if set to true., - name: isVersioningEnabled, - } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id411 - apiVersions: [] - language: - default: - { - description: Versioning is enabled if set to true., - name: Boolean, - } - protocol: {} - type: BOOLEAN - serializedName: isVersioningEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Deprecated in favor of isVersioningEnabled - property., name: automaticSnapshotPolicyEnabled } - java: { description: Deprecated in favor of isVersioningEnabled - property., name: automaticSnapshotPolicyEnabled } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id412 - apiVersions: [] - language: - default: - { description: Deprecated in favor of isVersioningEnabled - property., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: automaticSnapshotPolicyEnabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The blob service properties for change - feed events., name: changeFeed } - java: { description: The blob service properties for change feed - events., name: changeFeed } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id572 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The blob service properties for change - feed events., name: ChangeFeed, namespace: "" } - java: { description: The blob service properties for change - feed events., name: ChangeFeed } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Indicates whether change feed event - logging is enabled for the Blob service., name: enabled } - java: { description: Indicates whether change feed event - logging is enabled for the Blob service., name: enabled } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id413 - apiVersions: [] - language: - default: - { description: Indicates whether change feed event - logging is enabled for the Blob service., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Indicates the duration of changeFeed - retention in days. Minimum value is 1 day and maximum - value is 146000 days (400 years). A null value indicates - an infinite retention of the change feed., name: retentionInDays } - java: { description: Indicates the duration of changeFeed - retention in days. Minimum value is 1 day and maximum - value is 146000 days (400 years). A null value indicates - an infinite retention of the change feed., name: retentionInDays } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id488 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: Indicates the duration of changeFeed - retention in days. Minimum value is 1 day and maximum - value is 146000 days (400 years). A null value indicates - an infinite retention of the change feed., name: ChangeFeedRetentionInDays } - maximum: 146000.0 - minimum: 1.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: retentionInDays - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: changeFeed - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The blob service properties for blob - restore policy., name: restorePolicy } - java: { description: The blob service properties for blob restore - policy., name: restorePolicy } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id573 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The blob service properties for blob - restore policy, name: RestorePolicyProperties, namespace: "" } - java: - { description: The blob service properties for blob restore - policy, name: RestorePolicyProperties } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Blob restore is enabled if set to - true., name: enabled } - java: - { - description: Blob restore is enabled if set to true., - name: enabled, - } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id414 - apiVersions: [] - language: - default: { description: Blob restore is enabled if set - to true., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enabled - - apiVersions: [] - isDiscriminator: false - language: - default: { description: how long this blob can be restored. - It should be great than zero and less than DeleteRetentionPolicy.days., name: days } - java: { description: how long this blob can be restored. - It should be great than zero and less than DeleteRetentionPolicy.days., name: days } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id489 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: - { description: how long this blob can be restored. - It should be great than zero and less than DeleteRetentionPolicy.days., name: RestorePolicyPropertiesDays } - maximum: 365.0 - minimum: 1.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: days - - apiVersions: [] - isDiscriminator: false - language: - default: - { description: Deprecated in favor of minRestoreTime - property., name: lastEnabledTime } - java: { description: Deprecated in favor of minRestoreTime - property., name: lastEnabledTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id471 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: - { description: Deprecated in favor of minRestoreTime - property., name: RestorePolicyPropertiesLastEnabledTime } - protocol: {} - type: DATE_TIME - serializedName: lastEnabledTime - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Returns the minimum date and time - that the restore can be started., name: minRestoreTime } - java: { description: Returns the minimum date and time that - the restore can be started., name: minRestoreTime } - nullable: false - protocol: {} - readOnly: true - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.DateTimeSchema &id472 - apiVersions: - - { version: "2021-01-01" } - format: DATE_TIME - language: - default: { description: Returns the minimum date and time - that the restore can be started., name: RestorePolicyPropertiesMinRestoreTime } - protocol: {} - type: DATE_TIME - serializedName: minRestoreTime - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: restorePolicy - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The blob service properties for container - soft delete., name: containerDeleteRetentionPolicy } - java: { description: The blob service properties for container - soft delete., name: containerDeleteRetentionPolicy } - nullable: false - protocol: {} - readOnly: false - required: false - schema: *id338 - serializedName: containerDeleteRetentionPolicy - - apiVersions: [] - isDiscriminator: false - language: - default: { description: The blob service property to configure - last access time based tracking policy., name: lastAccessTimeTrackingPolicy } - java: { description: The blob service property to configure last - access time based tracking policy., name: lastAccessTimeTrackingPolicy } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ObjectSchema &id574 - apiVersions: - - { version: "2021-01-01" } - flattenedSchema: false - language: - default: { description: The blob service properties for Last - access time based tracking policy., name: LastAccessTimeTrackingPolicy, namespace: "" } - java: { description: The blob service properties for Last access - time based tracking policy., name: LastAccessTimeTrackingPolicy } - maxProperties: 0.0 - minProperties: 0.0 - properties: - - apiVersions: [] - isDiscriminator: false - language: - default: { description: When set to true last access time - based tracking is enabled., name: enable } - java: { description: When set to true last access time based - tracking is enabled., name: enable } - nullable: false - protocol: {} - readOnly: false - required: true - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.BooleanSchema &id415 - apiVersions: [] - language: - default: { description: When set to true last access time - based tracking is enabled., name: Boolean } - protocol: {} - type: BOOLEAN - serializedName: enable - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Name of the policy. The valid value - is AccessTimeTracking. This field is currently read - only, name: name } - java: { description: Name of the policy. The valid value - is AccessTimeTracking. This field is currently read - only, name: name } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ChoiceSchema &id441 - apiVersions: - - { version: "2021-01-01" } - choiceType: *id010 - choices: - - language: - default: - { description: "", name: ACCESS_TIME_TRACKING } - value: AccessTimeTracking - language: - default: - { description: Name of the policy. The valid value - is AccessTimeTracking. This field is currently read - only, name: Name } - java: { description: Name of the policy. The valid value - is AccessTimeTracking. This field is currently read - only, name: Name } - protocol: {} - type: CHOICE - serializedName: name - - apiVersions: [] - isDiscriminator: false - language: - default: { description: "The field specifies blob object - tracking granularity in days, typically how often the - blob object should be tracked.This field is currently - read only with value as 1", name: trackingGranularityInDays } - java: - { description: "The field specifies blob object tracking - granularity in days, typically how often the blob object - should be tracked.This field is currently read only - with value as 1", name: trackingGranularityInDays } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.NumberSchema &id490 - apiVersions: - - { version: "2021-01-01" } - exclusiveMaximum: false - exclusiveMinimum: false - language: - default: { description: "The field specifies blob object - tracking granularity in days, typically how often - the blob object should be tracked.This field is currently - read only with value as 1", name: LastAccessTimeTrackingPolicyTrackingGranularityInDays } - maximum: 0.0 - minimum: 0.0 - multipleOf: 0.0 - precision: 32.0 - protocol: {} - type: INTEGER - serializedName: trackingGranularityInDays - - apiVersions: [] - isDiscriminator: false - language: - default: { description: An array of predefined supported - blob types. Only blockBlob is the supported value. This - field is currently read only, name: blobType } - java: { description: An array of predefined supported blob - types. Only blockBlob is the supported value. This field - is currently read only, name: blobType } - nullable: false - protocol: {} - readOnly: false - required: false - schema: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.ArraySchema &id387 - apiVersions: - - { version: "2021-01-01" } - elementType: - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.StringSchema &id725 - apiVersions: - - { version: "2021-01-01" } - language: - default: - { - description: "", - name: LastAccessTimeTrackingPolicyBlobTypeItem, - } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - language: - default: { description: An array of predefined supported - blob types. Only blockBlob is the supported value. - This field is currently read only, name: LastAccessTimeTrackingPolicyBlobType } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: blobType - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: lastAccessTimeTrackingPolicy - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - } - serializedName: properties - - apiVersions: [] - isDiscriminator: false - language: - default: { description: Sku name and tier., name: sku } - java: { description: Sku name and tier., name: sku } - nullable: false - protocol: {} - readOnly: true - required: false - schema: *id126 - serializedName: sku - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "INPUT": null, - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - language: - default: - { - description: List of blob services returned., - name: BlobServiceItemsValue, - } - maxItems: 0.0 - minItems: 0.0 - protocol: {} - type: ARRAY - uniqueItems: false - serializedName: value - protocol: {} - stronglyTypedHeader: false - type: OBJECT - usage: - !!set { - !!com.microsoft.typespec.http.client.generator.core.extension.model.codemodel.SchemaContext "OUTPUT": null, - } - signatureParameters: - - *id336 - - *id337 - - &id339 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - PutBlobServices: - parameters: - BlobServicesName: default - accountName: sto8607 - api-version: 2020-08-01-preview - monitor: "true" - parameters: - properties: - changeFeed: { enabled: true, retentionInDays: 7 } - cors: - corsRules: - - allowedHeaders: [x-ms-meta-abc, x-ms-meta-data*, x-ms-meta-target*] - allowedMethods: [GET, HEAD, POST, OPTIONS, MERGE, PUT] - allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"] - exposedHeaders: [x-ms-meta-*] - maxAgeInSeconds: 100 - - allowedHeaders: ["*"] - allowedMethods: [GET] - allowedOrigins: ["*"] - exposedHeaders: ["*"] - maxAgeInSeconds: 2 - - allowedHeaders: [x-ms-meta-12345675754564*] - allowedMethods: [GET, PUT] - allowedOrigins: ["http://www.abc23.com", "https://www.fabrikam.com/*"] - exposedHeaders: [x-ms-meta-abc, x-ms-meta-data*, x -ms-meta-target*] - maxAgeInSeconds: 2000 - defaultServiceVersion: "2017-07-29" - deleteRetentionPolicy: { days: 300, enabled: true } - isVersioningEnabled: true - resourceGroupName: res4410 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobServicesPut.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices - id: /subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default - properties: - changeFeed: { enabled: true, retentionInDays: 7 } - cors: - corsRules: - - allowedHeaders: [x-ms-meta-abc, x-ms-meta-data*, x-ms-meta-target*] - allowedMethods: [GET, HEAD, POST, OPTIONS, MERGE, PUT] - allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"] - exposedHeaders: [x-ms-meta-*] - maxAgeInSeconds: 100 - - allowedHeaders: ["*"] - allowedMethods: [GET] - allowedOrigins: ["*"] - exposedHeaders: ["*"] - maxAgeInSeconds: 2 - - allowedHeaders: [x-ms-meta-12345675754564*] - allowedMethods: [GET, PUT] - allowedOrigins: ["http://www.abc23.com", "https://www.fabrikam.com/*"] - exposedHeaders: [x-ms-meta-abc, x-ms-meta-data*, x -ms-meta-target*] - maxAgeInSeconds: 2000 - defaultServiceVersion: "2017-07-29" - deleteRetentionPolicy: { days: 300, enabled: true } - isVersioningEnabled: true - sku: { name: Standard_GRS, tier: Standard } - BlobServicesPutLastAccessTimeBasedTracking: - parameters: - BlobServicesName: default - accountName: sto8607 - api-version: 2020-08-01-preview - monitor: "true" - parameters: - properties: - lastAccessTimeTrackingPolicy: - name: AccessTimeTracking - blobType: [blockBlob] - enable: true - trackingGranularityInDays: 1 - resourceGroupName: res4410 - subscriptionId: "{subscription-id}" - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobServicesPutLastAccessTimeBasedTracking.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices - id: /subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default - properties: - lastAccessTimeTrackingPolicy: - name: AccessTimeTracking - blobType: [blockBlob] - enable: true - trackingGranularityInDays: 1 - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Sets the properties of a storage account’s Blob service, - including properties for Storage Analytics and CORS (Cross-Origin Resource - Sharing) rules. ", name: SetServiceProperties } - java: { description: "Sets the properties of a storage account’s Blob service, - including properties for Storage Analytics and CORS (Cross-Origin Resource - Sharing) rules. ", name: setServiceProperties } - operationGroup: *id334 - operationId: BlobServices_SetServiceProperties - parameters: - - *id030 - - &id340 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id339 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id341 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id339 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id342 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the blob Service within the specified storage - account. Blob Service Name must be 'default', name: blobServicesName, serializedName: BlobServicesName } - java: { description: The name of the blob Service within the specified storage - account. Blob Service Name must be 'default', name: blobServicesName, serializedName: BlobServicesName } - nullable: false - operation: *id339 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id082 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id340 - - *id341 - - *id035 - - *id031 - - *id342 - - &id344 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: "The properties of a storage account’s Blob service, - including properties for Storage Analytics and CORS (Cross-Origin Resource - Sharing) rules.", name: parameters } - java: { description: "The properties of a storage account’s Blob service, - including properties for Storage Analytics and CORS (Cross-Origin Resource - Sharing) rules.", name: parameters } - nullable: false - operation: *id339 - protocol: - http: { explode: false, in: BODY, style: JSON } - required: true - schema: *id343 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id339 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - method: put - path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName} - uri: "{$host}" - signatureParameters: - - *id340 - - *id341 - - *id344 - responses: - - language: - default: { description: OK -- Sets The properties of a storage account’s Blob - service successfully., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id343 - signatureParameters: - - *id340 - - *id341 - - &id345 - apiVersions: - - { version: "2021-01-01" } - exceptions: [] - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsExamples: - examples: - GetBlobServices: - parameters: - { - BlobServicesName: default, - accountName: sto8607, - api-version: 2020-08-01-preview, - monitor: "true", - resourceGroupName: res4410, - subscriptionId: "{subscription-id}", - } - x-ms-original-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/main/specification/storage/resource-manager/Microsoft.Storage/stable/2021-01-01/examples/BlobServicesGet.json - responses: - "200": - body: - name: default - type: Microsoft.Storage/storageAccounts/blobServices - id: /subscriptions/{subscription-id}/resourceGroups/res4410/providers/Microsoft.Storage/storageAccounts/sto8607/blobServices/default - properties: - changeFeed: { enabled: true, retentionInDays: 7 } - cors: - corsRules: - - allowedHeaders: [x-ms-meta-abc, x-ms-meta-data*, x-ms-meta-target*] - allowedMethods: [GET, HEAD, POST, OPTIONS, MERGE, PUT] - allowedOrigins: ["http://www.contoso.com", "http://www.fabrikam.com"] - exposedHeaders: [x-ms-meta-*] - maxAgeInSeconds: 100 - - allowedHeaders: ["*"] - allowedMethods: [GET] - allowedOrigins: ["*"] - exposedHeaders: ["*"] - maxAgeInSeconds: 2 - - allowedHeaders: [x-ms-meta-12345675754564*] - allowedMethods: [GET, PUT] - allowedOrigins: ["http://www.abc23.com", "https://www.fabrikam.com/*"] - exposedHeaders: [x-ms-meta-abc, x-ms-meta-data*, x -ms-meta-target*] - maxAgeInSeconds: 2000 - defaultServiceVersion: "2017-07-29" - deleteRetentionPolicy: { days: 300, enabled: true } - isVersioningEnabled: true - sku: { name: Standard_GRS, tier: Standard } - xmsFlattened: false - xmsLongRunningOperation: false - xmsSkipUrlEncoding: false - language: - default: { description: "Gets the properties of a storage account’s Blob service, - including properties for Storage Analytics and CORS (Cross-Origin Resource - Sharing) rules.", name: GetServiceProperties } - java: { description: "Gets the properties of a storage account’s Blob service, - including properties for Storage Analytics and CORS (Cross-Origin Resource - Sharing) rules.", name: getServiceProperties } - operationGroup: *id334 - operationId: BlobServices_GetServiceProperties - parameters: - - *id030 - - &id346 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - java: { description: The name of the resource group within the user's subscription. - The name is case insensitive., name: resourceGroupName, serializedName: resourceGroupName } - nullable: false - operation: *id345 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id042 - - &id347 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the storage account within the specified - resource group. Storage account names must be between 3 and 24 characters - in length and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - java: { description: The name of the storage account within the specified resource - group. Storage account names must be between 3 and 24 characters in length - and use numbers and lower-case letters only., name: accountName, serializedName: accountName } - nullable: false - operation: *id345 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id043 - - *id035 - - *id031 - - &id348 - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: The name of the blob Service within the specified storage - account. Blob Service Name must be 'default', name: blobServicesName, serializedName: BlobServicesName } - java: { description: The name of the blob Service within the specified storage - account. Blob Service Name must be 'default', name: blobServicesName, serializedName: BlobServicesName } - nullable: false - operation: *id345 - protocol: - http: { explode: false, in: PATH } - required: true - schema: *id082 - protocol: {} - requests: - - language: - default: { description: "", name: "" } - parameters: - - *id030 - - *id346 - - *id347 - - *id035 - - *id031 - - *id348 - - apiVersions: [] - flattened: false - implementation: METHOD - language: - default: { description: Accept header, name: accept, serializedName: Accept } - java: { description: Accept header, name: accept, serializedName: Accept } - nullable: false - operation: *id345 - origin: modelerfour:synthesized/accept - protocol: - http: { explode: false, in: HEADER } - required: true - schema: *id047 - protocol: - http: - { - explode: false, - method: get, - path: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/blobServices/{BlobServicesName}", - uri: "{$host}", - } - signatureParameters: - - *id346 - - *id347 - responses: - - language: - default: { description: OK -- returned the properties of a storage account’s - Blob service., name: "" } - protocol: - http: - explode: false - knownMediaType: JSON - mediaTypes: [application/json] - statusCodes: ["200"] - schema: *id343 - signatureParameters: - - *id346 - - *id347 - protocol: {} - - *id005 -protocol: - http: { explode: false } -schemas: - ands: [] - arrays: - - *id349 - - *id350 - - *id351 - - *id352 - - *id353 - - *id354 - - *id355 - - *id356 - - *id357 - - *id358 - - *id359 - - *id360 - - *id361 - - *id362 - - *id363 - - *id364 - - *id365 - - *id366 - - *id367 - - *id368 - - *id369 - - *id370 - - *id371 - - *id372 - - *id373 - - *id374 - - *id375 - - *id376 - - *id377 - - *id378 - - *id379 - - *id380 - - *id381 - - *id382 - - *id383 - - *id384 - - *id385 - - *id386 - - *id387 - - *id388 - - *id389 - - *id390 - - *id391 - - *id392 - binaries: [] - booleans: - - *id393 - - *id394 - - *id395 - - *id396 - - *id397 - - *id398 - - *id134 - - *id399 - - *id400 - - *id137 - - *id139 - - *id140 - - *id153 - - *id401 - - *id402 - - *id403 - - *id404 - - *id405 - - *id406 - - *id407 - - *id408 - - *id409 - - *id410 - - *id411 - - *id412 - - *id413 - - *id414 - - *id415 - - *id416 - - *id417 - - *id418 - - *id026 - - *id419 - byteArrays: [] - chars: [] - choices: - - *id117 - - *id119 - - *id420 - - *id421 - - *id422 - - *id423 - - *id424 - - *id425 - - *id426 - - *id427 - - *id135 - - *id428 - - *id138 - - *id429 - - *id430 - - *id431 - - *id432 - - *id433 - - *id434 - - *id193 - - *id435 - - *id234 - - *id436 - - *id251 - - *id437 - - *id438 - - *id439 - - *id440 - - *id441 - - *id442 - - *id443 - - *id444 - - *id445 - - *id446 - - *id447 - - *id448 - constants: - - *id449 - - *id047 - - *id450 - - apiVersions: - - { version: "2021-01-01" } - language: *id451 - protocol: {} - type: CONSTANT - value: { value: Allow } - valueType: *id010 - - apiVersions: - - { version: "2021-01-01" } - language: *id452 - protocol: {} - type: CONSTANT - value: { value: kerb } - valueType: *id010 - - *id082 - credentials: [] - dateTimes: - - *id453 - - *id454 - - *id455 - - *id456 - - *id457 - - *id458 - - *id459 - - *id460 - - *id461 - - *id462 - - *id463 - - *id464 - - *id465 - - *id466 - - *id467 - - *id468 - - *id469 - - *id470 - - *id471 - - *id472 - - *id473 - - *id474 - - *id475 - - *id476 - dates: [] - dictionaries: - - *id477 - - *id478 - - apiVersions: [] - elementType: *id274 - language: - default: { description: Resource tags., name: TrackedResourceTags } - java: { description: Resource tags., name: TrackedResourceTags } - protocol: {} - type: DICTIONARY - - *id479 - - *id480 - durations: [] - flags: [] - groups: [] - numbers: - - *id481 - - *id482 - - *id483 - - *id484 - - *id485 - - *id486 - - *id487 - - *id488 - - *id489 - - *id490 - - *id491 - - *id492 - - *id493 - - *id494 - - *id495 - objects: - - *id496 - - *id497 - - *id498 - - *id499 - - *id500 - - *id501 - - *id502 - - *id503 - - *id504 - - *id505 - - *id506 - - *id507 - - *id508 - - *id509 - - *id126 - - *id127 - - *id128 - - *id510 - - *id511 - - *id129 - - *id130 - - *id512 - - *id018 - - *id513 - - *id514 - - *id131 - - *id515 - - *id516 - - *id517 - - *id133 - - *id518 - - *id136 - - *id142 - - *id519 - - *id017 - - *id520 - - *id521 - - *id522 - - *id268 - - *id523 - - *id524 - - *id525 - - *id204 - - *id202 - - *id526 - - *id527 - - *id528 - - *id529 - - *id021 - - *id530 - - *id023 - - *id219 - - *id172 - - *id185 - - *id531 - - *id532 - - *id533 - - *id534 - - *id535 - - *id536 - - *id537 - - *id538 - - *id539 - - *id238 - - *id540 - - *id541 - - *id542 - - *id543 - - *id544 - - *id545 - - *id231 - - *id546 - - *id232 - - *id547 - - *id548 - - *id549 - - *id255 - - *id550 - - *id551 - - *id552 - - *id553 - - *id554 - - *id555 - - *id556 - - *id557 - - *id558 - - *id559 - - *id560 - - *id561 - - *id295 - - *id562 - - *id563 - - *id564 - - *id312 - - *id565 - - *id566 - - *id567 - - *id568 - - *id343 - - *id569 - - *id570 - - *id571 - - *id338 - - *id572 - - *id573 - - *id574 - - *id575 - - *id012 - - *id028 - - *id576 - - *id025 - - *id577 - - *id578 - - *id579 - - *id013 - - *id024 - - *id068 - - *id027 - - *id580 - - *id581 - odataQueries: [] - ors: [] - parameterGroups: [] - sealedChoices: - - *id118 - - *id582 - - *id583 - - *id132 - - *id584 - - *id016 - - *id585 - - *id586 - - *id587 - - *id194 - - *id588 - - *id589 - - *id019 - streams: [] - strings: - - *id010 - - *id590 - - *id591 - - *id592 - - *id593 - - *id594 - - *id595 - - *id596 - - *id597 - - *id598 - - *id599 - - *id600 - - *id601 - - *id602 - - *id603 - - *id604 - - *id605 - - *id606 - - *id607 - - *id608 - - *id609 - - *id610 - - *id611 - - *id612 - - *id613 - - *id042 - - *id043 - - *id614 - - *id615 - - *id032 - - *id616 - - *id617 - - *id618 - - *id619 - - *id620 - - *id621 - - *id622 - - *id623 - - *id624 - - *id625 - - *id626 - - *id627 - - *id628 - - *id629 - - *id630 - - *id631 - - *id632 - - *id633 - - *id634 - - *id635 - - *id636 - - *id637 - - *id638 - - *id639 - - *id640 - - *id641 - - *id642 - - *id643 - - *id644 - - *id645 - - *id646 - - *id647 - - *id648 - - *id649 - - *id650 - - *id651 - - *id652 - - *id653 - - *id654 - - *id655 - - *id656 - - *id657 - - *id658 - - *id659 - - *id660 - - *id661 - - *id662 - - *id663 - - *id274 - - apiVersions: - - { version: "1.0" } - extensions: - xmsAzureResource: false - xmsClientFlatten: false - xmsFlattened: false - xmsLongRunningOperation: false - xmsMutability: [read, create] - xmsSkipUrlEncoding: false - language: - default: - { description: The geo-location where the resource lives, name: TrackedResourceLocation } - maxLength: 0.0 - minLength: 0.0 - protocol: {} - type: STRING - - *id664 - - *id665 - - *id666 - - *id667 - - *id668 - - *id669 - - *id670 - - *id671 - - *id672 - - *id673 - - *id674 - - *id675 - - *id676 - - *id677 - - *id678 - - *id679 - - *id680 - - *id681 - - *id682 - - *id683 - - *id684 - - *id685 - - *id686 - - *id687 - - *id688 - - *id689 - - *id690 - - *id691 - - *id692 - - *id693 - - *id694 - - *id695 - - *id696 - - *id697 - - *id698 - - *id699 - - *id700 - - *id701 - - *id702 - - *id703 - - *id704 - - *id705 - - *id706 - - *id707 - - *id708 - - *id709 - - *id710 - - *id711 - - *id712 - - *id713 - - *id714 - - *id715 - - *id716 - - *id717 - - *id297 - - *id050 - - *id718 - - *id719 - - *id720 - - *id721 - - *id722 - - *id723 - - *id724 - - *id725 - - *id726 - - *id727 - - *id728 - - *id729 - - *id730 - - *id731 - - *id732 - - *id733 - - *id734 - - *id735 - - *id736 - - *id737 - - *id738 - - *id088 - - *id095 - - *id101 - - *id108 - - *id739 - - *id740 - - *id741 - - *id742 - unixtimes: [] - unknowns: [] - uris: [] - uuids: [] - xors: [] -security: - authenticationRequired: true - schemes: - - scopes: !!set { user_impersonation: null } - type: OAUTH2 - - scopes: !!set { user_impersonation: null } - type: OAUTH2 diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/logback-test.xml b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/logback-test.xml deleted file mode 100644 index 49624777e9..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/logback-test.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/yaml-property.yaml b/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/yaml-property.yaml deleted file mode 100644 index 0f5f577a35..0000000000 --- a/packages/typespec-java/src/azure-typespec-fluentgen/src/test/resources/yaml-property.yaml +++ /dev/null @@ -1,3 +0,0 @@ -extensions: - x-ms-examples: true -property-to-remap: true diff --git a/packages/typespec-java/src/azure-typespec-javagen/azure-typespec-javagen.iml b/packages/typespec-java/src/azure-typespec-javagen/azure-typespec-javagen.iml deleted file mode 100644 index 1cf1c27eef..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/azure-typespec-javagen.iml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/packages/typespec-java/src/azure-typespec-javagen/data-plane.md b/packages/typespec-java/src/azure-typespec-javagen/data-plane.md deleted file mode 100644 index 6b4a1279f7..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/data-plane.md +++ /dev/null @@ -1,24 +0,0 @@ -#### data-plane - -```yaml -azure-arm: false - -license-header: MICROSOFT_MIT_SMALL - -generate-client-interfaces: false -generate-client-as-impl: true -generate-sync-async-clients: true -generate-builder-per-client: true -sync-methods: all -enable-sync-stack: true -required-fields-as-ctor-args: true -enable-page-size: true -use-key-credential: true -use-object-for-unknown: true - -use-default-http-status-code-to-exception-type-mapping: true -polling: {} - -models-subpackage: implementation.models -client-logger: true -``` diff --git a/packages/typespec-java/src/azure-typespec-javagen/dependency-reduced-pom.xml b/packages/typespec-java/src/azure-typespec-javagen/dependency-reduced-pom.xml deleted file mode 100644 index ee3e73c11a..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/dependency-reduced-pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - azure-typespec-parent - com.azure.tools - 1.0.0-beta.5 - - 4.0.0 - com.azure.tools - azure-typespec-javagen - 1.0.0-beta.1 - - - local - - - - maven-shade-plugin - - - package - - shade - - - - - - maven-resources-plugin - - - copy-resources - generate-sources - - copy-resources - - - ${basedir}/src/main/resources - true - - - ${basedir} - - data-plane.md - - false - - - - - - - - - - - - - org.junit.jupiter - junit-jupiter-engine - 5.13.4 - test - - - junit-platform-engine - org.junit.platform - - - apiguardian-api - org.apiguardian - - - - - org.junit.jupiter - junit-jupiter-api - 5.13.4 - test - - - opentest4j - org.opentest4j - - - junit-platform-commons - org.junit.platform - - - apiguardian-api - org.apiguardian - - - - - org.junit.jupiter - junit-jupiter-params - 5.13.4 - test - - - apiguardian-api - org.apiguardian - - - - - - com.azure.typespec.Main - - diff --git a/packages/typespec-java/src/azure-typespec-javagen/pom.xml b/packages/typespec-java/src/azure-typespec-javagen/pom.xml deleted file mode 100644 index 66b1e05af9..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/pom.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - 4.0.0 - - - com.azure.tools - azure-typespec-parent - 1.0.0-beta.1 - ../pom.xml - - com.azure.tools - azure-typespec-javagen - 1.0.0-beta.1 - - - - com.microsoft.typespec - http-client-generator-core - 1.0.0-beta.1 - - - com.azure - azure-core - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - - - org.slf4j - slf4j-nop - 1.7.36 - - - org.junit.jupiter - junit-jupiter-engine - 5.13.4 - test - - - org.junit.jupiter - junit-jupiter-api - 5.13.4 - test - - - org.junit.jupiter - junit-jupiter-params - 5.13.4 - test - - - - - - - - - - com.azure.typespec.Main - - - - - - local - - - local - - - - - - org.apache.maven.plugins - maven-shade-plugin - - - package - - shade - - - - - - - - maven-resources-plugin - - - copy-resources - generate-sources - - copy-resources - - - ${basedir}/src/main/resources - true - - - ${basedir} - - data-plane.md - - false - - - - - - - - - - - diff --git a/packages/typespec-java/src/azure-typespec-javagen/readme.md b/packages/typespec-java/src/azure-typespec-javagen/readme.md deleted file mode 100644 index 3fe5ba8fe9..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/readme.md +++ /dev/null @@ -1,75 +0,0 @@ -#### Javagen - -```yaml -pass-thru: - - model-deduplicator - - subset-reducer - -use-extension: - "@autorest/modelerfour": "4.26.2" - -pipeline: - # --- extension remodeler --- - - # "Shake the tree", and normalize the model - modelerfour: - input: openapi-document/multi-api/identity # the plugin where we get inputs from - - # allow developer to do transformations on the code model. - modelerfour/new-transform: - input: modelerfour - - javagen: - scope: java - input: modelerfour/identity - output-artifact: java-files - - javagen/emitter: - input: javagen - scope: scope-javagen/emitter - -scope-javagen/emitter: - input-artifact: java-files - output-uri-expr: $key - -output-artifact: java-files - -modelerfour: - seal-single-value-enum-by-default: true - - skip-special-headers: - - Repeatability-Request-ID - - Repeatability-First-Sent -``` - -```yaml !$(data-plane) -modelerfour: - flatten-models: true - flatten-payloads: true - group-parameters: true - -use-object-for-unknown: true -``` - -```yaml $(data-plane) -modelerfour: - flatten-models: false - flatten-payloads: false - group-parameters: false - - lenient-model-deduplication: true - - naming: - choiceValue: upper - preserve-uppercase-max-length: 2 - override: - ip: Ip - id: Id - -require: - - $(this-folder)data-plane.md -``` - -```yaml $(data-plane) && $(sdk-integration) -regenerate-pom: true -``` diff --git a/packages/typespec-java/src/azure-typespec-javagen/src/main/java/com/azure/typespec/Main.java b/packages/typespec-java/src/azure-typespec-javagen/src/main/java/com/azure/typespec/Main.java deleted file mode 100644 index e1a5556272..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/src/main/java/com/azure/typespec/Main.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.typespec; - -import com.microsoft.typespec.http.client.generator.core.Javagen; -import com.microsoft.typespec.http.client.generator.core.extension.jsonrpc.Connection; - -public class Main { - - public static void main(String[] args) { - Connection connection = new Connection(System.out, System.in); - connection.dispatch("GetPluginNames", () -> "[\"javagen\"]"); - connection.dispatch("Process", (plugin, sessionId) -> new Javagen(connection, plugin, sessionId).process()); - connection.dispatchNotification("Shutdown", connection::stop); - connection.waitForAll(); - System.exit(0); - } -} diff --git a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/data-plane.md b/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/data-plane.md deleted file mode 100644 index 6b4a1279f7..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/data-plane.md +++ /dev/null @@ -1,24 +0,0 @@ -#### data-plane - -```yaml -azure-arm: false - -license-header: MICROSOFT_MIT_SMALL - -generate-client-interfaces: false -generate-client-as-impl: true -generate-sync-async-clients: true -generate-builder-per-client: true -sync-methods: all -enable-sync-stack: true -required-fields-as-ctor-args: true -enable-page-size: true -use-key-credential: true -use-object-for-unknown: true - -use-default-http-status-code-to-exception-type-mapping: true -polling: {} - -models-subpackage: implementation.models -client-logger: true -``` diff --git a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/eclipse-format-azure-sdk-for-java.xml b/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/eclipse-format-azure-sdk-for-java.xml deleted file mode 100644 index 8e5fa985b2..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/eclipse-format-azure-sdk-for-java.xml +++ /dev/null @@ -1,401 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/readme/pom.xml b/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/readme/pom.xml deleted file mode 100644 index f147ab95c9..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/readme/pom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - azure-typespec-parent - com.azure.tools - 1.0.0-beta.5 - - - com.azure - customization-loader - 1.0.0-beta.1 - 4.0.0 - - - - com.azure.tools - azure-typespec-customization - 1.0.0-beta.11 - - - diff --git a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/simplelogger.properties b/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/simplelogger.properties deleted file mode 100644 index 0c43e4d965..0000000000 --- a/packages/typespec-java/src/azure-typespec-javagen/src/main/resources/simplelogger.properties +++ /dev/null @@ -1,35 +0,0 @@ -# SLF4J's SimpleLogger configuration file -# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. -org.slf4j.simpleLogger.logFile=System.out - -# Default logging detail level for all instances of SimpleLogger. -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, defaults to "info". -org.slf4j.simpleLogger.defaultLogLevel=warn - -# Logging detail level for a SimpleLogger instance named "xxxxx". -# Must be one of ("trace", "debug", "info", "warn", or "error"). -# If not specified, the default logging detail level is used. -#org.slf4j.simpleLogger.log.xxxxx= - -# Set to true if you want the current date and time to be included in output messages. -# Default is false, and will output the number of milliseconds elapsed since startup. -#org.slf4j.simpleLogger.showDateTime=false - -# The date and time format to be used in the output messages. -# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. -# If the format is not specified or is invalid, the default format is used. -# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. -#org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z - -# Set to true if you want to output the current thread name. -# Defaults to true. -#org.slf4j.simpleLogger.showThreadName=true - -# Set to true if you want the Logger instance name to be included in output messages. -# Defaults to true. -#org.slf4j.simpleLogger.showLogName=true - -# Set to true if you want the last component of the name to be included in output messages. -# Defaults to false. -#org.slf4j.simpleLogger.showShortLogName=false diff --git a/packages/typespec-java/src/azure-typespec-partial-update/pom.xml b/packages/typespec-java/src/azure-typespec-partial-update/pom.xml deleted file mode 100644 index 7e030e3134..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/pom.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - 4.0.0 - - - com.azure.tools - azure-typespec-parent - 1.0.0-beta.1 - ../pom.xml - - com.azure.tools - azure-typespec-partial-update - 1.0.0-beta.1 - - - - com.microsoft.typespec - http-client-generator-core - 1.0.0-beta.1 - - - org.slf4j - slf4j-simple - 1.7.36 - test - - - org.junit.jupiter - junit-jupiter-api - 5.13.4 - test - - - - diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/java/com/azure/typespec/partialupdate/util/PartialUpdateHandlerTest.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/java/com/azure/typespec/partialupdate/util/PartialUpdateHandlerTest.java deleted file mode 100644 index f54744211f..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/java/com/azure/typespec/partialupdate/util/PartialUpdateHandlerTest.java +++ /dev/null @@ -1,495 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.partialupdate.util; - -import com.github.javaparser.ast.AccessSpecifier; -import com.github.javaparser.ast.CompilationUnit; -import com.github.javaparser.ast.body.ConstructorDeclaration; -import com.github.javaparser.ast.body.InitializerDeclaration; -import com.github.javaparser.ast.stmt.BlockStmt; -import com.microsoft.typespec.http.client.generator.core.partialupdate.util.PartialUpdateHandler; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import java.io.IOException; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static com.github.javaparser.StaticJavaParser.parse; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class PartialUpdateHandlerTest { - - @Test - public void testClassOrInterfaceFileToTestAddMemberToExistingFile() throws IOException, URISyntaxException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithAddedMemberClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(6, compilationUnit.getTypes().get(0).getMembers().size()); - assertEquals(2, compilationUnit.getTypes().get(0).getConstructors().size()); - assertEquals(2, compilationUnit.getTypes().get(0).getFields().size()); - assertEquals(2, compilationUnit.getTypes().get(0).getMethods().size()); - - assertEquals(1, compilationUnit.getTypes().get(0).getMethodsByName("addedMethod").size()); - assertTrue(compilationUnit.getTypes().get(0).getFieldByName("enumsClient").isPresent()); - assertEquals(2, compilationUnit.getTypes().get(0).getConstructors().get(1).getParameters().size()); - - } - - @Test - public void testClassOrInterfaceFileToTestUpdateMethodSignatureToExistingFile() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithUpdateMemberClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").size()); - assertEquals(2, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").get(0).getParameters().size()); - assertEquals("test", compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").get(0).getParameters().get(1).getName().asString()); - assertEquals(AccessSpecifier.NONE, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").get(0).getAccessSpecifier()); - } - - @Test - public void testClassOrInterfaceFileToTestRemoveMethodToExistingFile() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithRemovedMemberGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - // method is re-generated again - assertEquals(1, compilationUnit.getTypes().get(0).getMethods().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").size()); - } - - - @Test - public void testClassOrInterfaceFileToTestSawaggerAddAPI() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithAddedMemberGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(2, compilationUnit.getTypes().get(0).getMethods().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethodsByName("getWhitespaceWithResponse").size()); - } - - @Test - public void testClassOrInterfaceFileToTestGeneratedFileRemoveAPI() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithRemovedMemberGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(0, compilationUnit.getTypes().get(0).getMethods().size()); - } - - @Test - public void testClassOrInterfaceFileToTestGeneratedFileUpdateAPI() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithUpdateMemberGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethods().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").size()); - assertEquals("updateParam", compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").get(0).getParameter(1).getName().asString()); - } - - @Test - public void testClassOrInterfaceFileToTestGeneratedFileUpdateAPIAndExistingFileUpdateMethod() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithUpdateMemberClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithUpdateMemberGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethods().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").size()); - assertEquals("test", compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").get(0).getParameter(1).getName().asString()); - assertEquals(AccessSpecifier.NONE, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").get(0).getAccessSpecifier()); - } - - @Test - public void testClassOrInterfaceFileToTestGeneratedFileRemoveAPIAndExistingFileUpdateMethod() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithUpdateMemberClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithRemovedMemberGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethods().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").size()); - assertEquals("test", compilationUnit.getTypes().get(0).getMethodsByName("putNullWithResponse").get(0).getParameter(1).getName().asString()); - } - - @Test - public void testClassOrInterfaceFileToTestWhenGeneratedFileHasSameNameButDifferentSignatureWithExistingGeneratedMethodToTestThenShouldIncludeThisSameNameMethod() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/PagedGeneratedAsyncClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/PagedGeneratedAsyncClientWithConvenienceMethod.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(4, compilationUnit.getTypes().get(0).getMembers().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getConstructors().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getFields().size()); - assertEquals(2, compilationUnit.getTypes().get(0).getMethods().size()); - - assertEquals(2, compilationUnit.getTypes().get(0).getMethodsByName("list").size()); - } - - @Test - public void testClassOrInterfaceFileToTestWhenNoChangesAreMadeOnNextGenerationToTestThenTheFileShouldStaySame() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/PagedGeneratedAsyncClientWithConvenienceMethod.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/PagedGeneratedAsyncClientWithConvenienceMethod.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(4, compilationUnit.getTypes().get(0).getMembers().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getConstructors().size()); - assertEquals(1, compilationUnit.getTypes().get(0).getFields().size()); - assertEquals(2, compilationUnit.getTypes().get(0).getMethods().size()); - - assertEquals(2, compilationUnit.getTypes().get(0).getMethodsByName("list").size()); - } - - @Test - public void testClassOrInterfaceFileToTestVerifyGeneratedFileShouldNotContainDuplicateMethods() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithDuplicateMethodGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/StringOperationWithDuplicateMethodGeneratedClient.java").toURI())), StandardCharsets.UTF_8); - - Exception exception = assertThrows(RuntimeException.class, () -> { - PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - }); - - String expectedMessage = "Found duplicate methods in the generated file."; - String actualMessage = exception.getMessage(); - - assertTrue(actualMessage.contains(expectedMessage)); - - } - - @Test - public void testClassOrInterfaceFileToTestModelCustomization() throws URISyntaxException, IOException { - String existingFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/Model.java").toURI())), StandardCharsets.UTF_8); - String generatedFileContent = new String(Files.readAllBytes(Paths.get(getClass().getClassLoader().getResource("partialupdate/GeneratedModel.java").toURI())), StandardCharsets.UTF_8); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - assertEquals(9, compilationUnit.getTypes().get(0).getMembers().size()); - assertEquals(3, compilationUnit.getTypes().get(0).getFields().size()); - assertEquals(2, compilationUnit.getTypes().get(0).getConstructors().size()); - assertEquals(4, compilationUnit.getTypes().get(0).getMethods().size()); - - } - - @Test - public void testModuleInfoFileToTestWhenGeneratedFileEqualsExistingFileToTestThenUseGeneratedFile() { - String existingFileContent = "// Copyright (c) Microsoft Corporation. All rights reserved.\n" + - "// Licensed under the MIT License.\n" + - "// Code generated by Microsoft (R) AutoRest Code Generator.\n" + - "\n" + - "module com.azure.iot.deviceupdate {\n" + - "\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.iot.deviceupdate;\n" + - "}\n"; - String generatedFileContent = "// Copyright (c) Microsoft Corporation. All rights reserved.\n" + - "// Licensed under the MIT License.\n" + - "// Code generated by Microsoft (R) AutoRest Code Generator.\n" + - "\n" + - "module com.azure.iot.deviceupdate {\n" + - "\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.iot.deviceupdate;\n" + - "}\n"; - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(true, compilationUnit.getModule().isPresent()); - assertEquals("com.azure.iot.deviceupdate", compilationUnit.getModule().get().getName().toString()); - assertEquals(2, compilationUnit.getModule().get().getDirectives().size()); - } - - @Test - public void testModuleInfoFileToTestWhenExistingFileHasUpdatesToTestThenUseExistingFile() { - String existingFileContent = "// Copyright (c) Microsoft Corporation. All rights reserved.\n" + - "// Licensed under the MIT License.\n" + - "// Code generated by Microsoft (R) AutoRest Code Generator.\n" + - "\n" + - "\n" + - "module com.azure.messaging.webpubsubnew {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.messaging.webpubsubnew;\n" + - " exports com.azure.messaging.webpubsubnew.models;\n" + - "}"; - String generatedFileContent = "// Copyright (c) Microsoft Corporation. All rights reserved.\n" + - "// Licensed under the MIT License.\n" + - "// Code generated by Microsoft (R) AutoRest Code Generator.\n" + - "\n" + - "\n" + - "module com.azure.messaging.webpubsubnew {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.messaging.webpubsubnew;\n" + - "}"; - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertNotNull(compilationUnit.getOrphanComments()); - assertEquals(3, compilationUnit.getOrphanComments().size()); - assertEquals(true, compilationUnit.getModule().isPresent()); - assertEquals("com.azure.messaging.webpubsubnew", compilationUnit.getModule().get().getName().toString()); - assertEquals(3, compilationUnit.getModule().get().getDirectives().size()); - } - - @Test - public void testModuleInfoFileToTestMergeExistingFileAndGeneratedFileToTestWhenExistingFileContentHasMoreDirectives() { - String existingFileContent = "// Copyright (c) Microsoft Corporation. All rights reserved.\n" + - "// Licensed under the MIT License.\n" + - "// Code generated by Microsoft (R) AutoRest Code Generator.\n" + - "module com.azure.messaging.webpubsubnew {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.messaging.webpubsubnew;\n" + - " exports com.azure.messaging.webpubsubnew.models;\n" + - "}"; - String generatedFileContent = "// Copyright (c) Microsoft Corporation. All rights reserved.\n" + - "// Licensed under the MIT License.\n" + - "// Code generated by Microsoft (R) AutoRest Code Generator.\n" + - "module com.azure.messaging.webpubsubnew {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.messaging.webpubsubnew;\n" + - "}"; - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(true, compilationUnit.getModule().isPresent()); - assertEquals("com.azure.messaging.webpubsubnew", compilationUnit.getModule().get().getName().toString()); - assertEquals(3, compilationUnit.getModule().get().getDirectives().size()); - assertEquals("requires transitive com.azure.core;", compilationUnit.getModule().get().getDirectives().get(0).asModuleRequiresDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.messaging.webpubsubnew;", compilationUnit.getModule().get().getDirectives().get(1).asModuleExportsDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.messaging.webpubsubnew.models;", compilationUnit.getModule().get().getDirectives().get(2).asModuleExportsDirective().getTokenRange().get().toString()); - - } - - @Test - public void testModuleInfoFileToTestMergeExistingFileAndGeneratedFileToTestWhenGeneratedFileContentHasMoreDirectives() { - String existingFileContent = "module com.azure.communication.phonenumbersdemo {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.communication.phonenumbersdemo;\n" + - "}"; - String generatedFileContent = "" + - "module com.azure.communication.phonenumbersdemo {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.communication.phonenumbersdemo;\n" + - " exports com.azure.communication.phonenumbersdemo.models;\n" + - "\n" + - " opens com.azure.communication.phonenumbersdemo.implementation.models to\n" + - " com.azure.core,\n" + - " com.fasterxml.jackson.databind;\n" + - " opens com.azure.communication.phonenumbersdemo.models to\n" + - " com.azure.core,\n" + - " com.fasterxml.jackson.databind;\n" + - "}"; - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(true, compilationUnit.getModule().isPresent()); - assertEquals("com.azure.communication.phonenumbersdemo", compilationUnit.getModule().get().getName().toString()); - assertEquals(5, compilationUnit.getModule().get().getDirectives().size()); - assertEquals("requires transitive com.azure.core;", compilationUnit.getModule().get().getDirectives().get(0).asModuleRequiresDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.communication.phonenumbersdemo;", compilationUnit.getModule().get().getDirectives().get(1).asModuleExportsDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.communication.phonenumbersdemo.models;", compilationUnit.getModule().get().getDirectives().get(2).asModuleExportsDirective().getTokenRange().get().toString()); - assertEquals("opens com.azure.communication.phonenumbersdemo.implementation.models to com.azure.core, com.fasterxml.jackson.databind;", compilationUnit.getModule().get().getDirectives().get(3).asModuleOpensDirective().getTokenRange().get().toString()); - assertEquals("opens com.azure.communication.phonenumbersdemo.models to com.azure.core, com.fasterxml.jackson.databind;", compilationUnit.getModule().get().getDirectives().get(4).asModuleOpensDirective().getTokenRange().get().toString()); - } - - @Test - public void testModuleInfoFileToTestMergeExistingFileAndGeneratedFileToTestWhenExistingAndGeneratedFileHasSameContent() { - String existingFileContent = "module com.azure.communication.phonenumbersdemo {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.communication.phonenumbersdemo;\n" + - " exports com.azure.communication.phonenumbersdemo.models;\n" + - "\n" + - " opens com.azure.communication.phonenumbersdemo.implementation.models to\n" + - " com.azure.core,\n" + - " com.fasterxml.jackson.databind;\n" + - " opens com.azure.communication.phonenumbersdemo.models to\n" + - " com.azure.core,\n" + - " com.fasterxml.jackson.databind;\n" + - "}"; - String generatedFileContent = - "module com.azure.communication.phonenumbersdemo {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.communication.phonenumbersdemo;\n" + - " exports com.azure.communication.phonenumbersdemo.models;\n" + - "\n" + - " opens com.azure.communication.phonenumbersdemo.implementation.models to\n" + - " com.azure.core,\n" + - " com.fasterxml.jackson.databind;\n" + - " opens com.azure.communication.phonenumbersdemo.models to\n" + - " com.azure.core,\n" + - " com.fasterxml.jackson.databind;\n" + - "}"; - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(true, compilationUnit.getModule().isPresent()); - assertEquals("com.azure.communication.phonenumbersdemo", compilationUnit.getModule().get().getName().toString()); - assertEquals(5, compilationUnit.getModule().get().getDirectives().size()); - assertEquals("requires transitive com.azure.core;", compilationUnit.getModule().get().getDirectives().get(0).asModuleRequiresDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.communication.phonenumbersdemo;", compilationUnit.getModule().get().getDirectives().get(1).asModuleExportsDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.communication.phonenumbersdemo.models;", compilationUnit.getModule().get().getDirectives().get(2).asModuleExportsDirective().getTokenRange().get().toString()); - assertEquals("opens com.azure.communication.phonenumbersdemo.implementation.models to com.azure.core, com.fasterxml.jackson.databind;", compilationUnit.getModule().get().getDirectives().get(3).asModuleOpensDirective().getTokenRange().get().toString()); - assertEquals("opens com.azure.communication.phonenumbersdemo.models to com.azure.core, com.fasterxml.jackson.databind;", compilationUnit.getModule().get().getDirectives().get(4).asModuleOpensDirective().getTokenRange().get().toString()); - } - - @Test - public void testModuleInfoFileToTestMergeExistingFileAndGeneratedFileToTestIgnoreEmptyLineAndWhiteSpace() { - String existingFileContent = "module com.azure.communication.phonenumbersdemo {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - "\n" + - " exports com.azure.communication.phonenumbersdemo; \n" + - " exports com.azure.communication.phonenumbersdemo.models;\n" + - "\n" + - "}"; - String generatedFileContent = - "module com.azure.communication.phonenumbersdemo {\n" + - " requires transitive com.azure.core;\n" + - "\n" + - " exports com.azure.communication.phonenumbersdemo;\n" + - " exports com.azure.communication.phonenumbersdemo.models;\n" + - "\n" + - "}"; - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(true, compilationUnit.getModule().isPresent()); - assertEquals("com.azure.communication.phonenumbersdemo", compilationUnit.getModule().get().getName().toString()); - assertEquals(3, compilationUnit.getModule().get().getDirectives().size()); - assertEquals("requires transitive com.azure.core;", compilationUnit.getModule().get().getDirectives().get(0).asModuleRequiresDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.communication.phonenumbersdemo;", compilationUnit.getModule().get().getDirectives().get(1).asModuleExportsDirective().getTokenRange().get().toString()); - assertEquals("exports com.azure.communication.phonenumbersdemo.models;", compilationUnit.getModule().get().getDirectives().get(2).asModuleExportsDirective().getTokenRange().get().toString()); - } - - @Test - public void testStaticBlockOverride() throws Exception { - String existingFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/ModelWithStaticBlock.java").toURI())); - String generatedFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/ModelWithStaticBlockGenerated.java").toURI())); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - List staticInitializerDeclaration = compilationUnit.getTypes().get(0).getMembers().stream() - .filter(m -> m instanceof InitializerDeclaration) - .map(m -> (InitializerDeclaration) m) - .filter(InitializerDeclaration::isStatic) - .collect(Collectors.toList()); - // verify 1 block - Assertions.assertEquals(1, staticInitializerDeclaration.size()); - // verify the block is replaced - Assertions.assertTrue(staticInitializerDeclaration.get(0).toString().contains("// token for test")); - } - - @Test - public void testStaticBlockAdd() throws Exception { - String existingFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/ModelWithoutStaticBlock.java").toURI())); - String generatedFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/ModelWithStaticBlockGenerated.java").toURI())); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - List staticInitializerDeclaration = compilationUnit.getTypes().get(0).getMembers().stream() - .filter(m -> m instanceof InitializerDeclaration) - .map(m -> (InitializerDeclaration) m) - .filter(InitializerDeclaration::isStatic) - .collect(Collectors.toList()); - // verify 1 block - Assertions.assertEquals(1, staticInitializerDeclaration.size()); - // also verify a few other methods is added - Assertions.assertNotNull(compilationUnit.getTypes().get(0).getMethodsByName("serializeAsJsonMergePatch")); - Assertions.assertNotNull(compilationUnit.getTypes().get(0).getFieldByName("jsonMergePatch")); - Assertions.assertNotNull(compilationUnit.getTypes().get(0).getFieldByName("updatedProperties")); - } - - - @Test - public void testStaticBlockRemove() throws Exception { - String existingFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/ModelWithStaticBlock.java").toURI())); - String generatedFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/ModelWithoutStaticBlockGenerated.java").toURI())); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - assertEquals(1, compilationUnit.getTypes().size()); - List staticInitializerDeclaration = compilationUnit.getTypes().get(0).getMembers().stream() - .filter(m -> m instanceof InitializerDeclaration) - .map(m -> (InitializerDeclaration) m) - .filter(InitializerDeclaration::isStatic) - .collect(Collectors.toList()); - // verify 0 block - Assertions.assertEquals(0, staticInitializerDeclaration.size()); - } - - @Test - public void testCodeFormatterOff() throws Exception { - String existingFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/ModelWithCodeFormatterOff.java").toURI())); - String generatedFileContent = Files.readString(Paths.get(getClass().getClassLoader().getResource("partialupdate/GeneratedModel.java").toURI())); - - String output = PartialUpdateHandler.handlePartialUpdateForFile(generatedFileContent, existingFileContent); - - CompilationUnit compilationUnit = parse(output); - ConstructorDeclaration constructorDeclaration = compilationUnit.getTypes().get(0).getConstructors().get(1); - Assertions.assertTrue(constructorDeclaration.getJavadoc().get().getDescription().toText().contains("")); - Assertions.assertTrue(constructorDeclaration.getJavadoc().get().getDescription().toText().contains("")); - BlockStmt constructorCodeBlock = (BlockStmt) constructorDeclaration.getChildNodes().stream().filter(node -> node instanceof BlockStmt).findFirst().get(); - List lines = Arrays.stream(constructorCodeBlock.toString().split("\n")).map(String::trim).collect(Collectors.toList()); - Assertions.assertTrue(lines.contains("// @formatter:off")); - Assertions.assertTrue(lines.contains("// @formatter:on")); - } -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/GeneratedModel.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/GeneratedModel.java deleted file mode 100644 index 35310d8844..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/GeneratedModel.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.partialupdate.util; - -import com.azure.core.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public final class Model { - /* - * Required field. - */ - @Generated - @JsonProperty(value = "requiredField", required = true) - private String requiredField; - - /* - * Optional field - */ - @Generated - @JsonProperty(value = "optionalField") - private String optionalField; - - /** - * Creates an instance of Model class. - * - * @param requiredField - */ - @Generated - public Model( - @JsonProperty(value = "requiredField", required = true) String requiredField) { - this.requiredField = requiredField; - } - - /** - * Get the requiredField property: Required field. - * - * @return the requiredField value. - */ - @Generated - public String getRequiredField() { - return this.requiredField; - } - - /** - * Get the optionalField property: Optional field. - * - * @return the optionalField value. - */ - @Generated - public String getOptionalField() { - return this.optionalField; - } - - /** - * Set the optionalField property: Optional field. - * - * @param optionalField the optionalField value to set. - * @return the Model object itself. - */ - @Generated - public Model setOptionalField(String optionalField) { - this.optionalField = optionalField; - return this; - } -} \ No newline at end of file diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/Model.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/Model.java deleted file mode 100644 index 525c76b7b8..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/Model.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.microsoft.typespec.http.client.generator.core.util; - -import com.azure.core.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public final class Model { - /* - * Required field. - */ - @Generated - @JsonProperty(value = "requiredField", required = true) - private String requiredField; - - /* - * Manually added Required field. - */ - private String addedRequiredField; - - /* - * Optional field - */ - @Generated - @JsonProperty(value = "optionalField") - private String optionalField; - - /** - * Creates an instance of Model class. - * - * @param requiredField - */ - Model( - @JsonProperty(value = "requiredField", required = true) String requiredField) { - this.requiredField = requiredField; - } - - /** - * Creates an instance of GeneratedModel class. - * - * @param addedRequiredField - * @param requiredField - */ - public Model( - String addedRequiredField, - @JsonProperty(value = "requiredField", required = true) String requiredField) { - this.addedRequiredField = addedRequiredField; - this.requiredField = requiredField; - } - - /** - * Get the requiredField property: Required field. - * - * @return the requiredField value. - */ - @Generated - public String getRequiredField() { - return this.requiredField; - } - - /** - * Get the optionalField property: Optional field. - * - * @return the optionalField value. - */ - @Generated - public String getOptionalField() { - return this.optionalField; - } - - /** - * Set the optionalField property: Optional field. - * - * @param optionalField the optionalField value to set. - * @return the Model object itself. - */ - @Generated - public Model setOptionalField(String optionalField) { - this.optionalField = optionalField; - return this; - } - - /** - * Get the addedRequiredField property: Manually added Required field. - * - * @return the addedRequiredField value. - */ - public String getAddedRequiredField() { - return this.addedRequiredField; - } - -} \ No newline at end of file diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithCodeFormatterOff.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithCodeFormatterOff.java deleted file mode 100644 index 2434f412d6..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithCodeFormatterOff.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.microsoft.typespec.http.client.generator.core.util; - -import com.azure.core.annotation.Generated; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public final class Model { - /* - * Required field. - */ - @Generated - @JsonProperty(value = "requiredField", required = true) - private String requiredField; - - /** - * Manually added Required field. - */ - private String addedRequiredField; - - /* - * Optional field - */ - @Generated - @JsonProperty(value = "optionalField") - private String optionalField; - - /** - * Creates an instance of Model class. - * - * @param requiredField - */ - Model( - @JsonProperty(value = "requiredField", required = true) String requiredField) { - this.requiredField = requiredField; - } - - /** - * - * Creates an instance of GeneratedModel class. - * - * - * - * - * - *
Header Parameters
NameTypeRequiredDescription
Content-TypeStringNoThe content type. Allowed values: "application/json".
- * - * - * @param addedRequiredField - * @param requiredField - */ - public Model( - String addedRequiredField, - @JsonProperty(value = "requiredField", required = true) String requiredField) { - // @formatter:off - this.addedRequiredField = addedRequiredField; - this.requiredField = requiredField; - // @formatter:on - } - - /** - * Get the requiredField property: Required field. - * - * @return the requiredField value. - */ - @Generated - public String getRequiredField() { - return this.requiredField; - } - - /** - * Get the optionalField property: Optional field. - * - * @return the optionalField value. - */ - @Generated - public String getOptionalField() { - return this.optionalField; - } - - /** - * Set the optionalField property: Optional field. - * - * @param optionalField the optionalField value to set. - * @return the Model object itself. - */ - @Generated - public Model setOptionalField(String optionalField) { - this.optionalField = optionalField; - return this; - } - - /** - * Get the addedRequiredField property: Manually added Required field. - * - * @return the addedRequiredField value. - */ - public String getAddedRequiredField() { - return this.addedRequiredField; - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithStaticBlock.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithStaticBlock.java deleted file mode 100644 index 4c1122464c..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithStaticBlock.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.microsoft.typespec.http.client.generator.core.util; - -import com.azure.communication.jobrouter.implementation.JsonMergePatchHelper; -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; - -import java.util.HashSet; -import java.util.Set; - -@Fluent -public final class Model { - - @Generated - private Boolean bypassSelectors; - - /** - * Creates an instance of ModelWithStaticBlock class. - */ - @Generated - public ModelWithStaticBlock() { - } - - @Generated - private boolean jsonMergePatch; - - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setDistributionModeInternalAccessor((model, jsonMergePatchEnabled) -> { - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - }); - } - - /** - * Get the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @return the bypassSelectors value. - */ - @Generated - public Boolean isBypassSelectors() { - return this.bypassSelectors; - } - - /** - * Set the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @param bypassSelectors the bypassSelectors value to set. - * @return the ModelWithStaticBlock object itself. - */ - @Generated - public DistributionModeInternal setBypassSelectors(Boolean bypassSelectors) { - this.bypassSelectors = bypassSelectors; - this.updatedProperties.add("bypassSelectors"); - return this; - } -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithStaticBlockGenerated.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithStaticBlockGenerated.java deleted file mode 100644 index ac00c77188..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithStaticBlockGenerated.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.microsoft.typespec.http.client.generator.core.util; - -import com.azure.communication.jobrouter.implementation.JsonMergePatchHelper; -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; - -import java.util.HashSet; -import java.util.Set; - -@Fluent -public final class Model { - - @Generated - private Boolean bypassSelectors; - - /** - * Creates an instance of ModelWithStaticBlock class. - */ - @Generated - public ModelWithStaticBlock() { - } - - @Generated - private boolean jsonMergePatch; - - @Generated - private final Set updatedProperties = new HashSet<>(); - - @Generated - void serializeAsJsonMergePatch(boolean jsonMergePatch) { - this.jsonMergePatch = jsonMergePatch; - } - - static { - JsonMergePatchHelper.setDistributionModeInternalAccessor((model, jsonMergePatchEnabled) -> { - // token for test - model.serializeAsJsonMergePatch(jsonMergePatchEnabled); - return model; - }); - } - - /** - * Get the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @return the bypassSelectors value. - */ - @Generated - public Boolean isBypassSelectors() { - return this.bypassSelectors; - } - - /** - * Set the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @param bypassSelectors the bypassSelectors value to set. - * @return the ModelWithStaticBlock object itself. - */ - @Generated - public DistributionModeInternal setBypassSelectors(Boolean bypassSelectors) { - this.bypassSelectors = bypassSelectors; - this.updatedProperties.add("bypassSelectors"); - return this; - } -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithoutStaticBlock.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithoutStaticBlock.java deleted file mode 100644 index 88a256bb10..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithoutStaticBlock.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.microsoft.typespec.http.client.generator.core.util; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; - -@Fluent -public final class Model { - - @Generated - private Boolean bypassSelectors; - - /** - * Creates an instance of ModelWithStaticBlock class. - */ - @Generated - public ModelWithStaticBlock() { - } - - /** - * Get the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @return the bypassSelectors value. - */ - @Generated - public Boolean isBypassSelectors() { - return this.bypassSelectors; - } - - /** - * Set the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @param bypassSelectors the bypassSelectors value to set. - * @return the ModelWithStaticBlock object itself. - */ - @Generated - public DistributionModeInternal setBypassSelectors(Boolean bypassSelectors) { - this.bypassSelectors = bypassSelectors; - this.updatedProperties.add("bypassSelectors"); - return this; - } -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithoutStaticBlockGenerated.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithoutStaticBlockGenerated.java deleted file mode 100644 index db26ff1522..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/ModelWithoutStaticBlockGenerated.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.microsoft.typespec.http.client.generator.core.util; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.Generated; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; - -@Fluent -public final class Model { - - @Generated - private Boolean bypassSelectors; - - /** - * Creates an instance of ModelWithStaticBlock class. - */ - @Generated - public ModelWithStaticBlock() { - } - - /** - * Get the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @return the bypassSelectors value. - */ - @Generated - public Boolean isBypassSelectors() { - return this.bypassSelectors; - } - - /** - * Set the bypassSelectors property: If set to true, then router will match workers to jobs even if they don't match label selectors. Warning: You may get workers that are not qualified for a job they are matched with if you set this variable to true. This flag is intended more for temporary usage. By default, set to false. - * - * @param bypassSelectors the bypassSelectors value to set. - * @return the ModelWithStaticBlock object itself. - */ - @Generated - public DistributionModeInternal setBypassSelectors(Boolean bypassSelectors) { - this.bypassSelectors = bypassSelectors; - this.updatedProperties.add("bypassSelectors"); - return this; - } -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/PagedGeneratedAsyncClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/PagedGeneratedAsyncClient.java deleted file mode 100644 index d22941a26d..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/PagedGeneratedAsyncClient.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.cadl.paged; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.cadl.paged.implementation.PagedClientImpl; -import com.cadl.paged.models.Resource; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; - -/** Initializes a new instance of the asynchronous PagedClient type. */ -@ServiceClient(builder = PagedClientBuilder.class, isAsync = true) -public final class PagedAsyncClient { - @Generated private final PagedClientImpl serviceClient; - - /** - * Initializes an instance of PagedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PagedAsyncClient(PagedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The list operation. - * - *

Response Body Schema - * - *

{@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list(RequestOptions requestOptions) { - return this.serviceClient.listAsync(requestOptions); - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/PagedGeneratedAsyncClientWithConvenienceMethod.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/PagedGeneratedAsyncClientWithConvenienceMethod.java deleted file mode 100644 index 7c1198d227..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/PagedGeneratedAsyncClientWithConvenienceMethod.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.cadl.paged; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.ClientAuthenticationException; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.exception.ResourceModifiedException; -import com.azure.core.exception.ResourceNotFoundException; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.util.BinaryData; -import com.cadl.paged.implementation.PagedClientImpl; -import com.cadl.paged.models.Resource; -import java.util.stream.Collectors; -import reactor.core.publisher.Flux; - -/** Initializes a new instance of the asynchronous PagedClient type. */ -@ServiceClient(builder = PagedClientBuilder.class, isAsync = true) -public final class PagedAsyncClient { - @Generated private final PagedClientImpl serviceClient; - - /** - * Initializes an instance of PagedAsyncClient class. - * - * @param serviceClient the service client implementation. - */ - @Generated - PagedAsyncClient(PagedClientImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * The list operation. - * - *

Response Body Schema - * - *

{@code
-     * {
-     *     id: String (Required)
-     *     name: String (Required)
-     *     type: String (Required)
-     * }
-     * }
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list(RequestOptions requestOptions) { - return this.serviceClient.listAsync(requestOptions); - } - - /** - * The list operation. - * - * @throws com.azure.core.exception.HttpResponseException thrown if the request is rejected by server. - * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. - * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. - * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return paged collection of Resource items as paginated response with {@link PagedFlux}. - */ - @Generated - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux list() { - // Generated convenience method for list - RequestOptions requestOptions = new RequestOptions(); - PagedFlux pagedFluxResponse = list(requestOptions); - return PagedFlux.create( - () -> - (continuationToken, pageSize) -> { - Flux> flux = - (continuationToken == null) - ? pagedFluxResponse.byPage().take(1) - : pagedFluxResponse.byPage(continuationToken).take(1); - return flux.map( - pagedResponse -> - new PagedResponseBase( - pagedResponse.getRequest(), - pagedResponse.getStatusCode(), - pagedResponse.getHeaders(), - pagedResponse.getValue().stream() - .map( - protocolMethodData -> - protocolMethodData.toObject(Resource.class)) - .collect(Collectors.toList()), - pagedResponse.getContinuationToken(), - null)); - }); - } -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationGeneratedClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationGeneratedClient.java deleted file mode 100644 index abafdc12c6..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationGeneratedClient.java +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationGeneratedClient { - - @Generated private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.putNullWithResponse(requestOptions); - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithAddedMemberClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithAddedMemberClient.java deleted file mode 100644 index 304c6a7602..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithAddedMemberClient.java +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; -import fixtures.bodystring.implementation.EnumsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationWithAddedMemberClient { - - @Generated private final StringOperationsImpl serviceClient; - - // manually add field - private EnumsImpl enumsClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - // manually add one constructor - StringOperationClient(StringOperationsImpl serviceClient, String test) { - this.serviceClient = serviceClient; - } - - /** - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.putNullWithResponse(requestOptions); - } - - // manually add method - public void addedMethod() { - System.out.println("addedMethod"); - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithAddedMemberGeneratedClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithAddedMemberGeneratedClient.java deleted file mode 100644 index 587aad0ce5..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithAddedMemberGeneratedClient.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationWithAddedMemberGeneratedClient { - - @Generated private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.putNullWithResponse(requestOptions); - } - - /** - * Get string value with leading and trailing whitespace '<tab><space><space>Now is the time for - * all good men to come to the aid of their country<tab><space><space>'. - * - *

Response Body Schema - * - *

{@code
-     * String
-     * }
- * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return string value with leading and trailing whitespace '<tab><space><space>Now is the time - * for all good men to come to the aid of their country<tab><space><space>'. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWhitespaceWithResponse(RequestOptions requestOptions) { - return this.serviceClient.getWhitespaceWithResponse(requestOptions); - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithDuplicateMethodGeneratedClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithDuplicateMethodGeneratedClient.java deleted file mode 100644 index b2e88be9d1..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithDuplicateMethodGeneratedClient.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationGeneratedClient { - - @Generated private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNullWithResponse(RequestOptions requestOptions) { - return this.serviceClient.putNullWithResponse(requestOptions); - } - - /** - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return the response. - */ - @Generated - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNullWithResponse(RequestOptions requestOption) { - return this.serviceClient.putNullWithResponse(requestOptions); - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithRemovedMemberClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithRemovedMemberClient.java deleted file mode 100644 index 3ad7be4737..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithRemovedMemberClient.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationWithRemovedMemberClient { - - @Generated private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithRemovedMemberGeneratedClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithRemovedMemberGeneratedClient.java deleted file mode 100644 index 860fb021fb..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithRemovedMemberGeneratedClient.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationWithRemovedMemberGeneratedClient { - - @Generated private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithUpdateMemberClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithUpdateMemberClient.java deleted file mode 100644 index fe5fa62056..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithUpdateMemberClient.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; -import fixtures.bodystring.implementation.EnumsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationWithUpdateMemberClient { - - @Generated private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * 2. manually update method signature - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response putNullWithResponse(RequestOptions requestOptions, String test) { - return this.serviceClient.putNullWithResponse(requestOptions); - } - - -} diff --git a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithUpdateMemberGeneratedClient.java b/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithUpdateMemberGeneratedClient.java deleted file mode 100644 index f012b98e62..0000000000 --- a/packages/typespec-java/src/azure-typespec-partial-update/src/test/resources/partialupdate/StringOperationWithUpdateMemberGeneratedClient.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.typespec.postprocessor.util; - -import com.azure.core.annotation.Generated; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceClient; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.rest.RequestOptions; -import com.azure.core.http.rest.Response; -import fixtures.bodystring.implementation.StringOperationsImpl; - -/** Initializes a new instance of the synchronous AutoRestSwaggerBatService type. */ -@ServiceClient(builder = AutoRestSwaggerBatServiceBuilder.class) -public final class StringOperationWithUpdateMemberGeneratedClient { - - @Generated private final StringOperationsImpl serviceClient; - - /** - * Initializes an instance of StringOperations client. - * - * @param serviceClient the service client implementation. - */ - @Generated - StringOperationClient(StringOperationsImpl serviceClient) { - this.serviceClient = serviceClient; - } - - /** - * - * @param requestOptions The options to configure the HTTP request before HTTP client sends it. - * @throws HttpResponseException thrown if the request is rejected by server. - * @return the response. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response putNullWithResponse(RequestOptions requestOptions, String updateParam) { - return this.serviceClient.putNullWithResponse(requestOptions); - } - -} diff --git a/packages/typespec-java/src/checkstyle-suppressions.xml b/packages/typespec-java/src/checkstyle-suppressions.xml deleted file mode 100644 index 9d4b375756..0000000000 --- a/packages/typespec-java/src/checkstyle-suppressions.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/typespec-java/src/checkstyle.xml b/packages/typespec-java/src/checkstyle.xml deleted file mode 100644 index 99a1d1b437..0000000000 --- a/packages/typespec-java/src/checkstyle.xml +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/typespec-java/src/typespec-extension/src/options.ts b/packages/typespec-java/src/options.ts similarity index 100% rename from packages/typespec-java/src/typespec-extension/src/options.ts rename to packages/typespec-java/src/options.ts diff --git a/packages/typespec-java/src/pom.xml b/packages/typespec-java/src/pom.xml deleted file mode 100644 index ff3bef42d7..0000000000 --- a/packages/typespec-java/src/pom.xml +++ /dev/null @@ -1,406 +0,0 @@ - - - 4.0.0 - - com.azure.tools - azure-typespec-parent - 1.0.0-beta.1 - pom - - Microsoft Azure TypeSpec for Java - This is the parent pom for Microsoft Azure TypeSpec for Java. - https://github.com/Azure/typespec-azure - - - - The MIT License (MIT) - https://opensource.org/licenses/MIT - repo - - - - - Microsoft Corporation - https://microsoft.com - - - - - microsoft - Microsoft Corporation - - - - - https://github.com/Azure/typespec-azure - scm:git:https://github.com/Azure/typespec-azure.git - - HEAD - - - - UTF-8 - ${project.build.directory} - false - true - - - true - - false - - ${project.artifactId}-jar-with-dependencies - - - - - - - com.azure - azure-core - 1.57.1 - - - - - - - - - org.apache.maven.plugins - maven-clean-plugin - 3.5.0 - - - - org.apache.maven.plugins - maven-jar-plugin - 3.4.2 - - - - org.apache.maven.plugins - maven-resources-plugin - 3.3.1 - - - - org.apache.maven.plugins - maven-install-plugin - 3.1.4 - - - - org.apache.maven.plugins - maven-shade-plugin - 3.6.0 - - ${shade.finalName} - true - - ${shade.mainClass} - - - - ${shade.mainClass} - - - - - - - - *:* - - - META-INF/*.MF - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.5.3 - - - **/*Test.java - **/*Tests.java - - alphabetical - false - - true - concurrent - ${parallelizeTests} - - 1 - false - - - - - - org.ow2.asm - asm - 9.3 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.14.0 - - 11 - 11 - - - - - com.azure.tools - codesnippet-maven-plugin - 1.0.0-beta.10 - - ${codesnippet.skip} - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.12.0 - - 1.8 - false - true - ${maven.javadoc.failOnWarnings} - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.6.0 - - - com.puppycrawl.tools - checkstyle - 9.3 - - - - ${checkstyle.skip} - checkstyle.xml - checkstyle-suppressions.xml - samedir= - UTF-8 - true - true - true - true - true - - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - ${project.build.directory}/jacoco.exec - - - - - - com.azure.tools - codesnippet-maven-plugin - - - update-codesnippets - - update-codesnippet - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - attach-javadocs - - jar - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - verify - - check - - - - - - - org.apache.maven.plugins - maven-source-plugin - 3.3.1 - - ${packageOutputDirectory} - - - - attach-sources - - jar - - package - - - - - - - org.apache.maven.plugins - maven-antrun-plugin - 3.1.0 - - - copy - package - - - - - - - run - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.4.0 - - - compile-samples-source - generate-test-sources - - add-test-source - - - - src/samples/java - - - - - - - - - - - tsp - - - tsp - - - - ./azure-typespec-customization - ../../../core/packages/http-client-java/generator/http-client-generator-core - ../../../core/packages/http-client-java/generator/http-client-generator-mgmt - ../../../core/packages/http-client-java/generator/http-client-generator - - - - - - - - azure-sdk-for-java - https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-java/maven/v1 - - true - - - true - - - - - central - https://repo.maven.apache.org/maven2 - - false - - - false - - - - - - - - azure-sdk-for-java - https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-java/maven/v1 - - true - - - true - - - - - central - https://repo.maven.apache.org/maven2 - - false - - - false - - - - - - ./azure-typespec-javagen - ./azure-typespec-extension - ./azure-typespec-customization - ./azure-typespec-fluentgen - ./azure-typespec-partial-update - ../../../core/packages/http-client-java/generator/http-client-generator-core - ../../../core/packages/http-client-java/generator/http-client-generator-mgmt - - - diff --git a/packages/typespec-java/src/readme.md b/packages/typespec-java/src/readme.md deleted file mode 100644 index 96a6bef53c..0000000000 --- a/packages/typespec-java/src/readme.md +++ /dev/null @@ -1,610 +0,0 @@ -# Overview - -This is the next gen (v4) of AutoRest Java generator. It's built on AutoRest v3, written in Java, and supports OpenAPI3. It generates clients that work with `com.azure:azure-core`. - -# Prerequisites - -You need to have the following installed on your machine: - -- Node.JS v12+ -- Java 11+ -- Maven 3 - -You need to have [autorest](https://www.npmjs.com/package/autorest) installed through NPM: - -```bash -npm install -g autorest -``` - -# Usage - -To use the latest released preview (https://github.com/Azure/autorest.java/releases), run - -```bash -autorest --java ---use:@autorest/java@4.x.x ---input-file:path/to/specs.json ---output-folder:where/to/generate/java/files ---namespace:specified.java.package -``` - -The first time running it will take a little longer to download and install all the components. - -To build from source code, clone this repo and checkout to main branch. Make sure all prerequisites are met, and run - -```bash -mvn package -P local -``` - -This will build a file `javagen-jar-with-dependencies.jar` under `javagen` module, a `fluentgen-jar-with-dependencies.jar` under `fluentgen` module. - -And then run AutoRest - -```bash -autorest --java ---use:where/this/repo/is/cloned/autorest.java ---input-file:path/to/specs.json ---output-folder:where/to/generate/java/files ---namespace:specified.java.package -``` - -Java files will be generated under `where/to/generate/java/files/src/main/java/specified/java/package`. - -To debug, add `--java.debugger` to the argument list. The JVM will suspend at the beginning of the execution. Then attach a remote debugger in your IDE to `localhost:5005`. **Make sure you detach the debugger before killing the AutoRest process. Otherwise it will fail to shut down the JVM and leave it orphaned. (which can be killed in the Task Manager)** - -# Recommended Settings - -- `use-default-http-status-code-to-exception-type-mapping: true`, use subclass of `HttpResponseException` defined in azure-core, when service returns unexpected status code. -- `generic-response-type: true`, use `ResponseBase<>`, instead a subclass of `ResponseBase<>`, for response with HTTP headers. Performance and reflective access improvement. -- `no-custom-headers: true`, generates overloads of interface methods that exclude typed headers. Performance improvement by removing the need to convert header strings to Java types. -- `required-fields-as-ctor-args`, create a constructor taking required properties, for model classes. The correctness of this constructor highly depends on the correctness of Swagger. -- `output-model-immutable: true`, make model classes immutable, if model is used only in response. -- `enable-sync-stack: true`, let sync method invoke sync RestProxy method. -- `enable-page-size: true`, let `maxpagesize` query parameter be supplied via `byPage` API in `PagedFlux` or `PagedIterable`. -- `use-key-credential: true`, use `KeyCredential` in builder for API key. - -- `generate-client-as-impl: true`, generate Client in implementation package, for customization. -- `models-subpackage: implementation.models`, generate model classes in implementation package. -- `custom-types-subpackage: models`, generate selected model classes in models package. - -# Settings - -Settings can be provided on the command line through `--name:value` or in a README file through `name: value`. The list of settings for AutoRest in general can be found at https://github.com/Azure/autorest/blob/main/docs/user/command-line-interface.md. The list of settings for AutoRest.Java specifically are listed below: - -| Option   | Description | -| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `--client-side-validations` | Generate validations for required parameters and required model properties. Default is false. | -| `--generate-client-as-impl` | Append "Impl" to the names of service clients and method groups and place them in the `implementation` sub-package. Default is false. | -| `--generate-client-interfaces` | Implies `--generate-client-as-impl` and generates interfaces for all the "Impl"s. Default is false. | -| `--generate-sync-async-clients` | Implies `--generate-client-as-impl` and generates sync and async convenience layer clients for all the "Impl"s. Default is false. | -| `--generate-builder-per-client` | Requires `--generate-sync-async-clients`, and generates one ClientBuilder for each Client. Default is false. | -| `--implementation-subpackage=STRING` | The sub-package that the Service client and Method Group client implementation classes will be put into. Default is `implementation`. | -| `--models-subpackage=STRING` | The sub-package that Enums, Exceptions, and Model types will be put into. Default is `models`. | -| `--sync-methods=all\|essential\|none` | Specifies mode for generating sync wrappers. Supported value are
  `essential` - generates only one sync returning body or header (default)
  `all` - generates one sync method for each async method
  `none` - does not generate any sync methods | -| `--required-parameter-client-methods` | Indicates whether client method overloads with only required parameters should be generated. Default is false. | -| `--custom-types=COMMA,SEPARATED,STRINGS` | Specifies a list of files to put in the package specified in `--custom-types-subpackage`. | -| `--custom-types-subpackage=STRING` | The sub-package that the custom types should be generated in. The types that custom types reference, or inherit from will also be automatically moved to this sub-package. **Recommended usage**: You can set this value to `models` and set `--models-subpackage=implementation.models`to generate models to `implementation.models` by default and pick specific models to be public through `--custom-types=`. | -| `--client-type-prefix=STRING` | The prefix that will be added to each generated client type. | -| `--service-interface-as-public` | Indicates whether to generate service interfaces as public. This resolves `SecurityManager` issues to prevent reflectively access non-public APIs. Default is true. | -| `--client-flattened-annotation-target=TYPE,FIELD,NONE,DISABLED` | Indicates the target of `@JsonFlatten` annotation for `x-ms-client-flatten`. Default is `TYPE`. | -| `--disable-client-builder` | Indicates whether to disable generating the `ClientBuilder` class. This is for SDK that already contains a hand-written `ClientBuilder` class. Default is false. | -| `--polling` | Configures how to generate long running operations. See [Polling Configuration](#polling-configuration) to see more details on how to use this flag. | -| `--service-name` | Service name used in Client class and other documentations. If not provided, service name is deduced from `title` configure (from swagger or readme). | -| `--partial-update` | Indicates whether to support partial update for `Client`/`AsyncClient` classes and `ClientBuilder` class. | -| `--default-http-exception-type` | The fully-qualified class name that should be used as the default HTTP exception type. The class must extend from `HttpResponseException`. | -| `--use-default-http-status-code-to-exception-type-mapping` | Indicates whether a default HTTP status code to exception mapping should be used if one isn't provided. | -| `--http-status-code-to-exception-type-mapping` | The HTTP status code to exception mapping that should be used. All exception types must be fully-qualified and extend from `HttpResponseException`. | -| `--generic-response-type` | Indicates that generic response types are used instead of named response types that extend the generic type. | -| `--no-custom-headers` | Indicates that overloads of interface methods that exclude typed headers are generated. | -| `--enable-sync-stack` | Indicates that sync method invokes sync RestProxy method. By default, sync method invokes async RestProxy method. | -| `--required-fields-as-ctor-args` | Indicates that class models have constructor taking required properties. | -| `--output-model-immutable` | Indicates that output-only models be generated as immutable, and without public constructor. | -| `--use-input-stream-for-binary` | Indicates that `InputStream` is used for binary response body. By default, `BinaryData` is used. | -| `--enable-page-size` | Indicates that `maxpagesize` query parameter be supplied via `byPage` API in `PagedFlux` or `PagedIterable`, instead of via client method parameter. | -| `--use-key-credential` | Indicates that builder uses `KeyCredential` for API key. | -| `--graal-vm-config` | Generates GraalVM config under `resources/META-INF/native-image`. | -| `--rename-model` | CSV. Rename classes. Each item is of pattern `from:to`. | - -## Settings for minimal data-plane clients - -`data-plane` option enables the generator to generate code for minimal data-plane clients. - -`data-plane` option will change the default value for some vanilla options. -For example, `generate-client-interfaces`, `generate-client-as-impl`, `generate-sync-async-clients`, `generate-builder-per-client`, `enable-sync-stack`, `required-fields-as-ctor-args` option is by default `true`. -`polling` is by default enabled as default settings globally (`polling={}`). - -`sdk-integration` option can be used for integrating to [azure-sdk-for-java](https://github.com/Azure/azure-sdk-for-java/). - -`generate-samples` option can be used for generating samples for client. -`generate-tests` option can be used for generating tests for client. - -See [documentation](docs/generate/dataplane.md) for frequently used options, and their effect on generated clients. - -## Additional settings for Fluent - -`fluent` option enables the generator extension for [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). - -Following settings only works when `fluent` option is specified. - -| Option | Description | -| ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `--fluent` | Enum. `LITE` for Fluent Lite; `PREMIUM` for Fluent Premium. Case insensitive. Default is `PREMIUM` if provided as other values. | -| `--fluent-subpackage` | String. The sub-package that vanilla client and builder will be put into. Default is `fluent`. | -| `--pom-file` | String. Name for Maven POM file. Default is `pom.xml`. | -| `--package-version` | String. Version number for Maven artifact. Default is `1.0.0-beta.1`. | -| `--service-name` | String. Service name used in Manager class and other documentations. If not provided, service name is deduced from `title` configure (from swagger or readme). | -| `--sdk-integration` | Boolean. Integrate to [azure-sdk-for-java](https://github.com/Azure/azure-sdk-for-java/). Default is `false`. Provide `output-folder` as absolute path for best performance. | -| `--generate-samples` | Boolean. Generate samples from `x-ms-examples` in swagger. Default is `false`. | -| `--add-inner` | CSV. Treat as inner class (move to `fluent.models` namespace, append `Inner` to class name). | -| `--remove-inner` | CSV. Exclude from inner classes. | -| `--rename-model` | CSV. Rename classes. Each item is of pattern `from:to`. | -| `--remove-model` | CSV. Remove classes. | -| `--preserve-model` | CSV. Preserve classes from clean-up. | -| `--remove-operation-group` | CSV. Remove operation groups. | -| `--name-for-ungrouped-operations` | String. Name for ungrouped operation group. Default to `ResourceProviders` for Lite. | -| `--resource-collection-associations` | Array. Prioritized association from resource model to resource collection. | - -`fluent` option will change the default value for some vanilla options. -For example, `generate-client-interfaces`, `required-parameter-client-methods` option is by default `true`. - -The code formatter would require Java 11+ runtime. - -## Polling configuration - -Polling configurations can be set through `--polling` setting globally or for each operation. The format is a key value map specified below: - -``` -polling: - {operationId}: - strategy: {strategy} - sync-strategy: {sync-strategy} - intermediate-type: {intermediate-type} - final-type: {final-type} - poll-interval: {poll-interval} -``` - -With the fields specified below: - -| Field | Type | Required | Description | Example | -| ----------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | -| operationId | String | true | The `operationId` of the operation. For global polling configuration, use `default`. Case insensitive. | `Pets_put` | -| strategy | String | false | The invocation to construct a polling strategy. Use fully qualified class name if outside the implementation subpackage specified in `namespace` & `implementation-subpackage`. Use dynamic literals `{httpPipeline}`, `{context}`, `{serializerAdapter}`, `{endpoint}`, `{serviceVersion}`, `{intermediate-type}`, `{final-type}` if these components are required to construct the polling strategy. Default is `new DefaultPollingStrategy<>(new PollingStrategyOptions({httpPipeline}).setEndpoint({endpoint}).setContext({context}).setServiceVersion({serviceVersion}))`. | `new com.azure.core.util.polling.OperationResourcePollingStrategy<>({httpPipeline}, {context})` | -| sync-strategy | String | false | Similar to `strategy`. It refers to the synchronous operation resource polling strategy. | | -| intermediate-type | String | false | The type of the polling intermediate type. Use fully qualified class name if outside the base package specified in `namespace`. Default is the return type specified on the operation in Swagger, or `BinaryData` if the operation returns `void`. | `PollResult`,`com.azure.core.util.BinaryData` | -| final-type | String | false | The type of the final result type. Use fully qualified class name if outside the base package specified in `namespace`. Default is the return type specified on the operation in Swagger, or `BinaryData` if the operation returns `void`. | `Pet`,`com.azure.core.util.BinaryData` | -| poll-interval | integer | false | The default interval in seconds to poll with (can be modified by users in `PollerFlux` and `SyncPoller`. Default is 1. | 30 | - -To use default settings globally, use `--polling={}`. - -## HTTP Status Code to Exception Type Handling - -By default, Swagger definitions will contain an exception type to be thrown when any error HTTP status code is seen. Swaggers -may also define the error HTTP status code to exception type mapping, but isn't always the case. Or, it may be needed to change -the default exception type to a custom type. In these cases it is possible to configure the error HTTP status code to exception -type handling by using the configurations `--default-http-exception-type`, `--use-default-http-status-code-to-exception-type-mapping`, -and `--http-status-code-to-exception-type-mapping`. - -NOTE: Using the configurations on an already shipped library will likely result in runtime breaking changes as most -libraries are already using a sub-class type of `HttpResponseException` and changing sub-types is a breaking change. - -### Default Http Exception Type - -The default exception type is used for all error HTTP response status codes that do not have an explicit exception type -configured. Generally, there is no error HTTP response status code to exception type mapping, so this will become your -general exception type. The following is an example of configuring `com.azure.core.exception.HttpResponseException` as -the default exception type: - -`autorest --default-http-exception-type=com.azure.core.exception.HttpResponseException` - -or in the Swagger README configuration: - -``` -default-http-exception-type: com.azure.core.exception.HttpResponseException -``` - -If this configuration isn't used the default exception type will be based on the Swagger definition. - -### Use Default HTTP Status Code to Exception Type Mapping - -The default error HTTP status code to exception type map is the following: - -| Status Code | Exception Type | -| ----------- | ------------------------------------------------------ | -| 401 | com.azure.core.exception.ClientAuthenticationException | -| 404 | com.azure.core.exception.ResourceNotFoundException | -| 409 | com.azure.core.exception.ResourceModifiedException | - -By default, this mapping isn't used, to use it pass the `--use-default-http-status-code-to-exception-type-mapping` to -the generator or in the Swagger README configuration: - -``` -use-default-http-status-code-to-exception-type-mapping: true -``` - -### Custom HTTP Status Code to Exception Type Mapping - -If you need to have a custom mapping it is possible to do so by using `--http-status-code-to-exception-type-mapping`. -This requires additional configuration in the Swagger README definition as it is a mapping of HTTP status code to -exception. The following is an example: - -``` -http-status-code-to-exception-type-mapping: - 404: com.azure.core.exception.ResourceNotFoundException - 412: com.azure.core.exception.ResourceExistsException -``` - -### Example - -The HTTP status code to exception type handling configurations can be used together to offer a nice baseline default -with additional customizations as need. For example, if you wanted to configure the default exception type, use most of -the default error HTTP status code to exception type, and customize one error HTTP status code exception type the following -configurations can be used. - -``` -default-http-exception-type: com.azure.core.exception.HttpResponseException -use-default-http-status-code-to-exception-type-mapping: true -http-status-code-to-exception-type-mapping: - 404: com.azure.core.exception.ResourceExistsException -``` - -This results in the following error HTTP response to exception type mapping: - -| Status Code | Exception Type | -| ----------- | ------------------------------------------------------ | -| 401 | com.azure.core.exception.ClientAuthenticationException | -| 404 | com.azure.core.exception.ResourceExistsException | -| 409 | com.azure.core.exception.ResourceModifiedException | -| \* | com.azure.core.exception.HttpResponseException | - -Notices how 404 changes from the default `com.azure.core.exception.ResourceNotFoundException` to -`com.azure.core.exception.ResourceExistsException`. - -# Minimal Data-Plane Clients - -You can generate the output as minimal data-plane clients with `--data-plane` flag. -The models will not be generated and the methods in the clients will be generated as [protocol methods](https://github.com/Azure/azure-sdk-for-java/wiki/Protocol-Methods). - -The generated code has the following structure: - -``` -- pom.xml -- /src/main/java - | - - module-info.java - - /com/azure// - | - - Builder.java - - Client.java - - AsyncClient.java - - /implementation - | - - ClientImpl.java -``` - -and requires latest `azure-core` as a dependency. - -# Customizations - -For guidance on using the post-code generation customization framework see its [documentation](https://github.com/Azure/autorest.java/tree/main/customization-base/README.md). - -# Project structure - -## javagen - -This contains the actual generator extension, including mappers that maps a code model to a Java client model, and templates that writes the Java client models into .java files. - -## fluentgen - -This contains the [generator extension for Azure Management Libraries](#additional-settings-for-fluent). - -## tests - -This contains the generated classes from the [test swaggers](https://github.com/Azure/autorest.testserver/tree/main/swagger) in `src/main`. The code here should always be kept up-to-date with the output of the generator in `javagen`. - -This also contains test code for these generated code under `src/test`. Running the tests will hit the test server running locally (see https://github.com/Azure/autorest.testserver for instructions) and verify the correctness of the generated code. - -# Working with the core submodule - -This repository uses a git -[submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) for the -[TypeSpec OSS core](https://github.com/microsoft/typespec). - -This section covers some basic everyday tasks for working with it. The steps -below are are really just one possible workflow. There's more than one way -to accomplish these tasks and if you prefer to do it differently, that's -fine too! - -## Configuring git to recurse submodules automatically for most commands - -Run the following command: - -``` -git config --global submodule.recurse true -``` - -This will effectively pass `--recurse-submodules` for you to git commands -that accept it. It should eliminate some of the common pain points around -submodules. - -NOTE: git clone is exceptional, see below. - -## Cloning recursively - -`git clone` does not recurse submodules automatically, even with -submodule.recurse=true as configured above. - -Fork the repo, then clone recursively as follows: - -``` -git clone --recurse-submodules https://github.com/(your_username)/autorest.java -``` - -## Updating and initializing the submodule - -In some situations, even with the above setting, you may still end up with the core/ folder -being uninitialized and not having a good clone of microsoft/typespec, or with the core/ folder -initialized, but checked out to the wrong commit for the current branch. To fix this, run the -following command to update and initialize the submodule: - -``` -git submodule update --init -``` - -## Point the submodule origin remote to your fork - -You can change the remotes of the submodule so that `origin` is your fork of -microsoft/typespec rather than microsoft/typespec itself, and microsoft/typespec is -`upstream`: - -``` -cd [repo_root] -cd core -git remote remove origin -git remote add origin https://github.com/(your_username)/typespec -git remote add upstream https://github.com/microsoft/typespec -``` - -## Build - -Run "Build-TypeSpec.ps1" script to build `@azure-tools/typespec-java` as TypeSpec emitter. - -The TypeSpec emitter can be installed via e.g. - -``` -npm install [repo_root]/typespec-extension/azure-tools-typespec-java-[version].tgz -``` - -Run "Build-AutoRest.ps1" script to build `@autorest/java` as Autorest extension. - -The AutoRest extension can be used via e.g. - -``` -autorest --use="[repo_root]" --java [readme.md] -``` - -:warning: the script would "checkout" unstaged code in "./core" submodule. Please stage/commit your code there. - -Before building Maven project and packaging NPM package, the script does 3 things: - -1. Apply a patch to code in "core", mainly for switching to `azure-autorest-customization` as customization lib. -- This is the only step that affect AutoRest extension. -2. Build the JAR for `core/packages/http-client-java/generator/http-client-generator` module (with the patch to code in step 1), and copy it to `typespec-extension/generator/http-client-generator`. -3. Copy the source from `core/packages/http-client-java/emitter` (with the patch to code in step 1) to `typespec-extension`. - -If you do not plan to modify these patched files in your PR, you can use "assume-unchanged" to ignore the changes on these files: - -``` -git update-index --assume-unchanged packages/http-client-java/generator/http-client-generator-core/pom.xml packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/postprocessor/Postprocessor.java packages/http-client-java/generator/http-client-generator/src/main/resources/readme/pom.xml -``` - -"no-assume-unchanged" would unset the files marked by "assume-unchanged". - -Alternatively, you can commit the patched files, and revert this commit before creating the pull request for review. - -## Making a cross-cutting change across both repos - -1. Make matching branches: - -``` -cd core -git checkout -b featurebranch - -cd .. -git checkout -b featurebranch -``` - -2. Make your changes as needed to both repos. - -3. Commit changes to both repos: - -``` -cd core -git commit -a -m "Core part of my change" - -cd .. -git commit -a -m "Azure-specific part of my change" -``` - -4. Push - -``` -git push origin featurebranch -``` - -NOTE: If you configured submodule.recurse=true as shown above, this will -automatically push the submodule typespec branch along with the autorest.java -branch. If you prefer not to use that, then `cd core` and push that too. - -5. Create 2 PRs from the two branches that were pushed to your - microsoft/typespec and Azure/autorest.java forks. Start with the microsoft/typespec - PR, then follow up with the Azure/autorest.java PR that depends on it. - -6. Get approval for both PRs before merging either of them. - -7. Merge the microsoft/typespec PR first. - -8. Update the submodule to point to the actual commit you merged to microsoft/typespec main: - -``` -cd core -git fetch --all -git checkout upstream/main - -cd .. -git commit -a -m "Update submodule" -git push origin featurebranch -``` - -9. Merge the autorest.java PR and you're done. - -Note that you only need to do all of the above when your changes span both -repos. If you are only changing one repo or the other, then just work in -each individual repo as you would any other. - -# Contributing - -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - -### Autorest plugin configuration - -- Please don't edit this section unless you're re-configuring how the Java extension plugs in to AutoRest - AutoRest needs the below config to pick this up as a plug-in - see https://github.com/Azure/autorest/blob/main/docs/developer/architecture/AutoRest-extension.md - -#### Javagen - -```yaml $(java) && !$(fluent) -use: $(this-folder)/javagen -``` - -```yaml $(java) && $(fluent) -use: $(this-folder)/fluentgen -``` - -#### Help - -```yaml -help-content: - java: - activationScope: java - categoryFriendlyName: Java Generator - settings: - - key: client-side-validations - type: bool - description: Generate validations for required parameters and required model properties. Default is false. - - key: generate-client-as-impl - type: bool - description: Append "Impl" to the names of service clients and method groups and place them in the `implementation` sub-package. Default is false. - - key: generate-client-interfaces - type: bool - description: Implies `--generate-client-as-impl` and generates interfaces for all the "Impl"s. Default is false. - - key: generate-sync-async-clients - type: bool - description: Implies `--generate-client-as-impl` and generates sync and async convenience layer clients for all the "Impl"s. Default is false. - - key: generate-builder-per-client - type: bool - description: Requires `--generate-sync-async-clients`, and generates one ClientBuilder for each Client. Default is false. - - key: implementation-subpackage=STRING - type: string - description: The sub-package that the Service client and Method Group client implementation classes will be put into. Default is `implementation`. - - key: models-subpackage=STRING - type: string - description: The sub-package that Enums, Exceptions, and Model types will be put into. Default is `models`. - - key: sync-methods - type: string - description: \[all|essential|none] Specifies mode for generating sync wrappers. Supported value are
  `essential` - generates only one sync returning body or header (default)
  `all` - generates one sync method for each async method
  `none` - does not generate any sync methods - - key: required-parameter-client-methods - type: bool - description: Indicates whether client method overloads with only required parameters should be generated. Default is false. - - key: custom-types - type: string - description: \[COMMA,SEPARATED,STRINGS] Specifies a list of files to put in the package specified in `--custom-types-subpackage`. - - key: custom-types-subpackage - type: string - description: The sub-package that the custom types should be generated in. The types that custom types reference, or inherit from will also be automatically moved to this sub-package. **Recommended usage** You can set this value to `models` and set `--models-subpackage=implementation.models`to generate models to `implementation.models` by default and pick specific models to be public through `--custom-types=`. - - key: client-type-prefix - type: string - description: The prefix that will be added to each generated client type. - - key: client-flattened-annotation-target - type: string - description: \[TYPE,FIELD,NONE,DISABLED] Indicates the target of `@JsonFlatten` annotation for `x-ms-client-flatten`. Default is `TYPE`. - - key: disable-client-builder - type: bool - description: Indicates whether to disable generating the `ClientBuilder` class. This is for SDK that already contains a hand-written `ClientBuilder` class. Default is false. - - key: polling - type: string - description: Configures how to generate long running operations. See [Polling Configuration](https://github.com/Azure/autorest.java#polling-configuration) to see more details on how to use this flag. - - key: service-name - type: string - description: Service name used in Client class and other documentations. If not provided, service name is deduced from `title` configure (from swagger or readme). - - key: partial-update - type: bool - description: Indicates whether to support partial update for `Client`/`AsyncClient` classes and `ClientBuilder` class. Default is false. - - key: enable-sync-stack - type: bool - description: Indicates that sync method invokes sync RestProxy method. By default, sync method invokes async RestProxy method. - - key: required-fields-as-ctor-args - type: bool - description: Indicates that class models have constructor taking required properties. - - key: output-model-immutable - type: bool - description: Indicates that output-only models be generated as immutable, and without public constructor. Default is false. - - key: data-plane - type: bool - description: Indicates whether to generate code for minimal clients. Default is false. - - javafluent: - activationScope: fluent - categoryFriendlyName: Java fluent Generator - settings: - - key: fluent - type: string - description: Enum. `LITE` for Fluent Lite; `PREMIUM` for Fluent Premium. Case insensitive. Default is `PREMIUM` if provided as other values. - - key: fluent-subpackage - type: string - description: String. The sub-package that vanilla client and builder will be put into. Default is `fluent`. - - key: pom-file - type: string - description: String. Name for Maven POM file. Default is `pom.xml`. - - key: package-version - type: string - description: String. Version number for Maven artifact. Default is `1.0.0-beta.1`. - - key: service-name - type: string - description: String. Service name used in Manager class and other documentations. If not provided, service name is deduced from `title` configure (from swagger or readme). - - key: sdk-integration - type: bool - description: Boolean. Integrate to [azure-sdk-for-java](https://github.com/Azure/azure-sdk-for-java/). Default is `false`. Provide `output-folder` as absolute path for best performance. - - key: generate-samples - type: bool - description: Boolean. Generate samples from `x-ms-examples` in swagger. Default is `false`. - - key: add-inner - type: string - description: CSV. Treat as inner class (move to `fluent.models` namespace, append `Inner` to class name). - - key: remove-inner - type: string - description: CSV. Exclude from inner classes. - - key: rename-model - type: string - description: CSV. Rename classes. Each item is of pattern `from:to`. - - key: remove-model - type: string - description: CSV. Remove classes. - - key: preserve-model - type: string - description: CSV. Preserve classes from clean-up. - - key: remove-operation-group - type: string - description: CSV. Remove operation groups. - - key: name-for-ungrouped-operations - type: string - description: String. Name for ungrouped operation group. Default to `ResourceProviders` for Lite. -``` diff --git a/packages/typespec-java/src/typespec-extension/readme.md b/packages/typespec-java/src/typespec-extension/readme.md deleted file mode 100644 index 007ee1fac7..0000000000 --- a/packages/typespec-java/src/typespec-extension/readme.md +++ /dev/null @@ -1,189 +0,0 @@ -# Prerequisite - -Install [Node.js](https://nodejs.org/en/download/) 20 or above. (Verify by running `node --version`) - -Install [Java](https://docs.microsoft.com/java/openjdk/download) 11 or above. (Verify by running `java --version`) - -Install [Maven](https://maven.apache.org/download.cgi). (Verify by running `mvn --version`) - -Install [TypeSpec](https://typespec.io/) 1.0.0. - -# Initialize TypeSpec Project - -Follow [TypeSpec Getting Started](https://typespec.io/docs/) to initialize your TypeSpec project. - -Make sure `npx tsp compile .` runs correctly. - -# Add TypeSpec-Java - -Run the command `npm install @azure-tools/typespec-java`. - -# Generate Java - -`npx tsp compile client.tsp --emit=@azure-tools/typespec-java` or `npx tsp compile client.tsp --emit=@azure-tools/typespec-java --options='@azure-tools/typespec-java.emitter-output-dir='`. - -If `emitter-output-dir` option is not provided, generated Java code will be under `tsp-output/@azure-tools/typespec-java` folder. - -# Optional Configuration - -## SDK - -One can further configure the SDK generated, using the emitter options on `@azure-tools/typespec-java`. - -```yaml -emit: - - "@azure-tools/typespec-java" -options: - "@azure-tools/typespec-java": - emitter-output-dir: "{project-root}/azure-ai-language-authoring" - service-name: "Authoring" - generate-samples: true - generate-tests: true - partial-update: false - api-version: "2023-11-01" -``` - -### SDK Related Configuration in Emitter options `tspconfig.yaml` - -#### `api-version` - -By default, the emitter generates code from the latest api-version in TypeSpec. - -In cases where a service needs to generate code from a previous api-version, set the value to that specific api-version. - -#### `service-name` - -This emitter option is for management-plane SDK. - -It is advised for the service to set an appropriate service name. E.g. `service-name: Standby Pool`. - -The name will appear in documentation (e.g. "README.md") that describes the service and the SDK. It would also affect the name of the entry class of the SDK. - -#### `partial-update` - -Default value is `false`. - -This emitter option is for data-plane SDK. - -In the case that the generated code is not good enough for the SDK, the developer can choose to customize the generated SDK via [Partial Update](https://github.com/Azure/azure-sdk-for-java/wiki/TypeSpec-Java-QuickStart#partial-update). Set the value to `true` to enable this feature. - -#### `generate-samples` - -Default value is `true`. The emitter generates code samples under the `generated` package. - -For data-plane SDK, the generated samples are for reference. The motivation is to show how samples can be written. It is expected that developers write correct and concise samples outside of the `generated` package. - -If there is customization of the generated SDK, the generated samples may not compile after customization. One can delete the `generated` package, and set the value to `false` to disable the generated samples. - -#### `generate-tests` - -Default value is `true`. The emitter generates tests under the `generated` package. - -For data-plane SDK, the generated tests are (disabled) live tests. The motivation is to show how test cases can be written in Java with JUnit. It is expected that developers write runnable tests outside of the `generated` package. - -For management-plane SDK, the generated tests are mock tests, for JSON serialization and API requests. - -If there is customization of the generated SDK, the generated tests may not compile after customization. One can delete the `generated` package, and set the value to `false` to disable the generated tests. - -### SDK Related Configuration in Client Customization `client.tsp` - -For Java SDK, it is required to provide a Java package name via `@clientNamespace`. - -Here is an example: - -```ts -@@clientNamespace(Client, "com.azure.ai.openai", "java"); -@@clientNamespace(Azure.OpenAI, "com.azure.ai.openai", "java"); -``` - -For management-plane SDK, one can provide a client name via `@clientName`. - -Here is an example: - -```ts -@@clientNamespace(Microsoft.StandbyPool, - "com.azure.resourcemanager.standbypool", - "java" -); -@@clientName(Microsoft.StandbyPool, "StandbyPoolManagementClient", "java"); -``` - -## Convenience API - -By default, TypeSpec-Java generates all protocol APIs and convenience APIs. -A few exceptions are API of JSON Merge Patch, and API of long-running operation with ambiguous response type. - -See "convenientAPI" decorator from [typespec-client-generator-core](https://github.com/Azure/typespec-azure/tree/main/packages/typespec-client-generator-core). - -# Customization - -All post-code customizations listed in this [documentation](https://github.com/Azure/autorest.java/tree/main/customization-base/README.md) are supported for code generated from TypeSpec. - -To configure customization with TypeSpec, Java's emitter options should include a `customization-class`. The `customization-class` option should specify the path to the file containing the customization code relative to `emitter-output-dir`. Note that the path should end with `src/main/java/.java`. The recommended practice is to place the customization class in `/customization/src/main/java/.java` and the `customization-class` option will have the value of `customization-class: customization/src/main/java/.java`. See example `tspconfig.yaml` below: - -```yaml -emit: - - "@azure-tools/typespec-java" -options: - "@azure-tools/typespec-java": - emitter-output-dir: "{project-root}/azure-ai-language-authoring" - namespace: "com.azure.ai.language.authoring" - customization-class: customization/src/main/java/MyCustomization.java -``` - -# Changelog - -See [changelog](https://github.com/Azure/autorest.java/blob/main/typespec-extension/changelog.md). - -# Troubleshooting - -### Enable logging in Java code - -To enable logging, use `tspconfig.yaml` to add the `loglevel: ` option. Typically, `tspconfig.yaml` file will be -located in the same directory as the `` file. The `loglevel` setting is a developer option and should be set under `options->dev-options`. The acceptable values for `loglevel` are -`off`, `debug`, `info`, `warn` and `error`. A sample `tspconfig.yaml` is shown below that enables logging at `info` level. By default, -logging is enabled at `error` level. - -```yaml -emit: - - "@azure-tools/typespec-java" -options: - "@azure-tools/typespec-java": - emitter-output-dir: "{project-root}/tsp-output" - namespace: "com.azure.ai.language.authoring" - dev-options: - loglevel: info -``` - -### Debugging Java code - -In order to set breakpoints and debug Java code locally on your development workspace, use the `tspconfig.yaml` file to -set the `debug` option to `true` under `options->dev-options` as shown in the example below. If the `debug` option is set -to `true`, then `tsp compile ` command will start the emitter which then invokes the Java process but the process -will be suspended until a debugger is attached to the process. The process listens on port 5005. Run the remote debugger -with this port on your IntelliJ or VS Code to connect to the Java process. This should now run the Java code generator -and breaks at all applicable breakpoints. - -The remote debugger configuration is shown below for reference. - -![img.png](https://raw.githubusercontent.com/Azure/autorest.java/main/docs/images/remote-debugger-config.png) - -```yaml -emit: - - "@azure-tools/typespec-java" -options: - "@azure-tools/typespec-java": - emitter-output-dir: "{project-root}/tsp-output" - namespace: "com.azure.ai.language.authoring" - dev-options: - debug: true -``` - -### New version of `@typespec/compiler` etc. - -Force an installation of new version via deleting `package-lock.json` and `node_modules` in `./typespec-extension` folder. - -```shell -rm -rf node_modules -rm package-lock.json -``` diff --git a/packages/typespec-java/src/typespec-extension/tsconfig.json b/packages/typespec-java/src/typespec-extension/tsconfig.json deleted file mode 100644 index 51d0329336..0000000000 --- a/packages/typespec-java/src/typespec-extension/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../../../core/tsconfig.base.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "." - }, - "include": ["src/**/*.ts", "test/**/*.ts"] -} diff --git a/packages/typespec-java/src/typespec-extension/vitest.config.ts b/packages/typespec-java/src/typespec-extension/vitest.config.ts deleted file mode 100644 index d08ede18e2..0000000000 --- a/packages/typespec-java/src/typespec-extension/vitest.config.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { defineConfig, mergeConfig } from "vitest/config"; -import { defaultTypeSpecVitestConfig } from "../../../../core/vitest.config.js"; - -export default mergeConfig(defaultTypeSpecVitestConfig, defineConfig({})); diff --git a/packages/typespec-java/tsconfig.json b/packages/typespec-java/tsconfig.json new file mode 100644 index 0000000000..7cacec1b29 --- /dev/null +++ b/packages/typespec-java/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../core/tsconfig.base.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": ".", + "tsBuildInfoFile": "temp/tsconfig.tsbuildinfo" + }, + "include": ["src/**/*.ts", "test/**/*.ts"] +} diff --git a/packages/typespec-java/turbo.json b/packages/typespec-java/turbo.json new file mode 100644 index 0000000000..99b4e169ea --- /dev/null +++ b/packages/typespec-java/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turbo.build/schema.json", + "extends": ["//"], + "tasks": { + "build": { + "dependsOn": ["^build"], + "cache": false + } + } +} diff --git a/packages/typespec-java/vitest.config.ts b/packages/typespec-java/vitest.config.ts new file mode 100644 index 0000000000..9fb08f57fb --- /dev/null +++ b/packages/typespec-java/vitest.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + isolate: false, + coverage: { + reporter: ["cobertura", "json", "text"], + }, + outputFile: { + junit: "./test-results.xml", + }, + include: ["test/**/*.test.ts"], + exclude: ["node_modules", "dist/test"], + }, + server: { + watch: { + ignored: [], + }, + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6269323a97..d054eb27ce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,10 +49,10 @@ catalogs: specifier: ~2.10.1 version: 2.10.1 '@azure-tools/openai-typespec': - specifier: 1.11.0 - version: 1.11.0 + specifier: 1.21.0 + version: 1.21.0 '@azure-tools/typespec-liftr-base': - specifier: 0.14.0 + specifier: '>=0.14.0 <1.0.0' version: 0.14.0 '@azure/abort-controller': specifier: ^2.1.2 @@ -364,8 +364,8 @@ catalogs: specifier: ^2.1.0 version: 2.1.0 js-yaml: - specifier: ~4.1.1 - version: 4.1.1 + specifier: ^4.2.0 + version: 4.2.0 lodash: specifier: ~4.18.1 version: 4.18.1 @@ -3687,45 +3687,45 @@ importers: specifier: 'catalog:' version: 4.1.9(@types/node@26.0.0)(@vitest/coverage-v8@4.1.9)(@vitest/ui@4.1.9)(happy-dom@20.10.6)(jsdom@25.0.1)(vite@8.1.0(@types/node@26.0.0)(esbuild@0.28.1)(tsx@4.22.4)(yaml@2.9.0)) - packages/typespec-java/src/typespec-extension: + packages/typespec-java: dependencies: '@autorest/codemodel': specifier: 'catalog:' version: 4.20.1 + '@azure-tools/codegen': + specifier: 'catalog:' + version: 2.10.1 js-yaml: specifier: 'catalog:' - version: 4.1.1 + version: 4.2.0 lodash: specifier: 'catalog:' version: 4.18.1 - devDependencies: - '@azure-tools/codegen': + yaml: specifier: 'catalog:' - version: 2.10.1 + version: 2.9.0 + devDependencies: '@azure-tools/openai-typespec': specifier: 'catalog:' - version: 1.11.0(@typespec/http@core+packages+http)(@typespec/openapi@core+packages+openapi) + version: 1.21.0(@typespec/http@core+packages+http)(@typespec/openapi@core+packages+openapi) '@azure-tools/typespec-autorest': specifier: workspace:^ - version: link:../../../typespec-autorest + version: link:../typespec-autorest '@azure-tools/typespec-azure-core': specifier: workspace:^ - version: link:../../../typespec-azure-core + version: link:../typespec-azure-core '@azure-tools/typespec-azure-resource-manager': specifier: workspace:^ - version: link:../../../typespec-azure-resource-manager + version: link:../typespec-azure-resource-manager '@azure-tools/typespec-azure-rulesets': specifier: workspace:^ - version: link:../../../typespec-azure-rulesets + version: link:../typespec-azure-rulesets '@azure-tools/typespec-client-generator-core': specifier: workspace:^ - version: link:../../../typespec-client-generator-core + version: link:../typespec-client-generator-core '@azure-tools/typespec-liftr-base': specifier: 'catalog:' version: 0.14.0 - '@microsoft/api-extractor': - specifier: 'catalog:' - version: 7.58.9(@types/node@26.0.0) '@types/js-yaml': specifier: 'catalog:' version: 4.0.9 @@ -3737,46 +3737,34 @@ importers: version: 26.0.0 '@typespec/compiler': specifier: workspace:^ - version: link:../../../../core/packages/compiler + version: link:../../core/packages/compiler '@typespec/events': specifier: workspace:^ - version: link:../../../../core/packages/events + version: link:../../core/packages/events '@typespec/http': specifier: workspace:^ - version: link:../../../../core/packages/http + version: link:../../core/packages/http '@typespec/openapi': specifier: workspace:^ - version: link:../../../../core/packages/openapi - '@typespec/openapi3': - specifier: workspace:^ - version: link:../../../../core/packages/openapi3 + version: link:../../core/packages/openapi '@typespec/rest': specifier: workspace:^ - version: link:../../../../core/packages/rest + version: link:../../core/packages/rest '@typespec/sse': specifier: workspace:^ - version: link:../../../../core/packages/sse + version: link:../../core/packages/sse '@typespec/streams': specifier: workspace:^ - version: link:../../../../core/packages/streams + version: link:../../core/packages/streams '@typespec/tspd': specifier: workspace:^ - version: link:../../../../core/packages/tspd + version: link:../../core/packages/tspd '@typespec/versioning': specifier: workspace:^ - version: link:../../../../core/packages/versioning + version: link:../../core/packages/versioning '@typespec/xml': specifier: workspace:^ - version: link:../../../../core/packages/xml - '@vitest/coverage-v8': - specifier: 'catalog:' - version: 4.1.9(vitest@4.1.9) - '@vitest/ui': - specifier: 'catalog:' - version: 4.1.9(vitest@4.1.9) - c8: - specifier: 'catalog:' - version: 11.0.0 + version: link:../../core/packages/xml rimraf: specifier: 'catalog:' version: 6.1.3 @@ -4390,11 +4378,11 @@ packages: resolution: {integrity: sha512-fZfREKjQnBTscjObgK4LuyZNFaofoCNQDNz0jl1i8fYNwCM5EOF9BXwtEtobuEyCpPUNDxQ/KKO65eWzirqk4w==} engines: {node: '>=12.0.0'} - '@azure-tools/openai-typespec@1.11.0': - resolution: {integrity: sha512-xxHeThd4CJZeOZ7JPV6lPj+8vSkO7V1qZ+zodQdZdlx0jDX7tTJ9VJ5ZakZ/R7g+3sfoECIuhE0TCz+Wq6nXWA==} + '@azure-tools/openai-typespec@1.21.0': + resolution: {integrity: sha512-wKHNsyXii+/ZJn/mqKC/ey+/Y+RoW7XGBQD5yNRhGKA3VRibLNIhn/0PGLEIZhWWsFp3okTvifhPDs/b0DmOTA==} peerDependencies: - '@typespec/http': '*' - '@typespec/openapi': '*' + '@typespec/http': ^1.13.0 + '@typespec/openapi': ^1.13.0 '@azure-tools/tasks@3.0.255': resolution: {integrity: sha512-GjALNLz7kWMEdRVbaN5g0cJHNAr3XVTbP0611Mv2UzMgGL6FOhNZJK+oPHJKLDR8EEDZNnkwPlyi7B+INXUSQA==} @@ -15179,7 +15167,7 @@ snapshots: js-yaml: 4.1.1 semver: 7.8.5 - '@azure-tools/openai-typespec@1.11.0(@typespec/http@core+packages+http)(@typespec/openapi@core+packages+openapi)': + '@azure-tools/openai-typespec@1.21.0(@typespec/http@core+packages+http)(@typespec/openapi@core+packages+openapi)': dependencies: '@typespec/http': link:core/packages/http '@typespec/openapi': link:core/packages/openapi @@ -20918,7 +20906,7 @@ snapshots: algoliasearch: 4.27.0 clipanion: 4.0.0-rc.4(typanion@3.14.0) diff: 5.2.2 - ink: 3.2.0(@types/react@19.2.17)(react@17.0.2) + ink: 3.2.0(@types/react@19.2.17)(react@19.2.7) ink-text-input: 4.0.3(ink@3.2.0(@types/react@19.2.17)(react@17.0.2))(react@17.0.2) react: 17.0.2 semver: 7.8.5 @@ -21068,7 +21056,7 @@ snapshots: '@yarnpkg/plugin-git': 3.2.0(@yarnpkg/core@4.9.0(typanion@3.14.0))(typanion@3.14.0) clipanion: 4.0.0-rc.4(typanion@3.14.0) es-toolkit: 1.48.1 - ink: 3.2.0(@types/react@19.2.17)(react@19.2.7) + ink: 3.2.0(@types/react@19.2.17)(react@17.0.2) react: 17.0.2 semver: 7.8.5 tslib: 2.8.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 6c0ccef194..9b4390d1c8 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,7 +1,6 @@ packages: - packages/* - - packages/typespec-java/src/* - - core/ + - core/ # Install core workspace dependencies too. Needed for prettier plugins - website/ - eng/feeds/ - core/packages/* @@ -9,7 +8,6 @@ packages: - "!core/packages/http-client-java/**" - "!core/packages/http-client-python/**" - "!core/packages/typespec-vs" - overrides: "cross-spawn@>=7.0.0 <7.0.5": "^7.0.5" rollup: 4.49.0 # Regression in 4.50.0 https://github.com/rollup/rollup/issues/6099 @@ -39,8 +37,8 @@ catalog: "@autorest/codemodel": ~4.20.1 "@azure-rest/core-client": ^2.3.1 "@azure-tools/codegen": ~2.10.1 - "@azure-tools/openai-typespec": "1.11.0" - "@azure-tools/typespec-liftr-base": "0.14.0" + "@azure-tools/openai-typespec": "1.21.0" + "@azure-tools/typespec-liftr-base": ">=0.14.0 <1.0.0" "@azure/abort-controller": ^2.1.2 "@azure/core-auth": ^1.6.0 "@azure/core-lro": ^3.1.0 @@ -144,7 +142,7 @@ catalog: happy-dom: ^20.9.0 hast-util-to-html: ^9.0.5 is-unicode-supported: ^2.1.0 - js-yaml: ~4.1.1 + js-yaml: ^4.2.0 lodash: ~4.18.1 log-symbols: ^7.0.1 lzutf8: "0.6.3" diff --git a/tsconfig.ws.json b/tsconfig.ws.json index 07da922a3a..c71b5b2218 100644 --- a/tsconfig.ws.json +++ b/tsconfig.ws.json @@ -11,7 +11,7 @@ { "path": "packages/typespec-metadata/tsconfig.build.json" }, { "path": "packages/samples/tsconfig.build.json" }, { "path": "packages/typespec-python/tsconfig.json" }, - { "path": "packages/typespec-java/typespec-extension/tsconfig.json" } + { "path": "packages/typespec-java/tsconfig.json" } ], "files": [] }